All Projects → elm → url

elm / url

Licence: BSD-3-Clause license
Build and parse URLs. Useful for HTTP and "routing" in single-page apps (SPAs)

Programming Languages

elm
856 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to url

Url Parser
Parse URLs into nicely structured data
Stars: ✭ 118 (+71.01%)
Mutual labels:  url, spa, routing
Abstract State Router
Like ui-router, but without all the Angular. The best way to structure a single-page webapp.
Stars: ✭ 288 (+317.39%)
Mutual labels:  spa, single-page-app, routing
Universal Router
A simple middleware-style router for isomorphic JavaScript web apps
Stars: ✭ 1,598 (+2215.94%)
Mutual labels:  spa, single-page-app, routing
Bidi
Bidirectional URI routing
Stars: ✭ 941 (+1263.77%)
Mutual labels:  url, routing
Frontexpress
An Express.js-Style router for the front-end
Stars: ✭ 263 (+281.16%)
Mutual labels:  url, spa
Ffrouter
Powerful and easy-to-use URL routing library in iOS that supports URL Rewrite(强大、易用、支持 URL Rewrite的 iOS 路由库)
Stars: ✭ 263 (+281.16%)
Mutual labels:  url, routing
Vue Stack 2.0
Vue 2.0 Project Boilerplate
Stars: ✭ 166 (+140.58%)
Mutual labels:  spa, single-page-app
Djurl
Simple yet helpful library for writing Django urls by an easy, short and intuitive way.
Stars: ✭ 85 (+23.19%)
Mutual labels:  url, routing
React Easy Params
🔗 Auto synchronize your state with the URL and LocalStorage.
Stars: ✭ 73 (+5.8%)
Mutual labels:  url, routing
react-redux-boilerplate
A React boilerplate based on Redux, React Router, styled components and Parcel
Stars: ✭ 62 (-10.14%)
Mutual labels:  spa, single-page-app
router-example
Use React Router DOM to create a Single Page Application (SPA).
Stars: ✭ 50 (-27.54%)
Mutual labels:  spa, routing
golgi
A composable routing library for Haxe.
Stars: ✭ 37 (-46.38%)
Mutual labels:  url, routing
The Elmish Book
A practical guide to building modern and reliable web applications in F# from first principles
Stars: ✭ 231 (+234.78%)
Mutual labels:  spa, routing
Django Multiurl
Have you ever wanted multiple views to match to the same URL? Now you can.
Stars: ✭ 268 (+288.41%)
Mutual labels:  url, routing
Json Schema Editor
JSON Schema Editor is an intuitive editor for JSON schema. It provides a tree view to present the structure of schema, and a property inspector to edit the properties of schema element. Develop with Vue.js 2 and Firebase.
Stars: ✭ 194 (+181.16%)
Mutual labels:  spa, single-page-app
site
RailroadPM.org 2.x Site
Stars: ✭ 18 (-73.91%)
Mutual labels:  spa, single-page-app
node-match-path
Matches a URL against a path. Parameters, wildcards, RegExp.
Stars: ✭ 30 (-56.52%)
Mutual labels:  url, routing
url-trailing-slash
Allows enforcing URL routes with or without trailing slash
Stars: ✭ 35 (-49.28%)
Mutual labels:  url, routing
Knockout Spa
A mini but full-fledged SPA framework and boilerplate to build SPAs fast and scalable
Stars: ✭ 145 (+110.14%)
Mutual labels:  spa, single-page-app
Redux Tower
Saga powered routing engine for Redux app.
Stars: ✭ 155 (+124.64%)
Mutual labels:  spa, routing

Work with URLs

This package helps you (1) build new URLs and (2) parse existing URLs into nice Elm data structures.

These tasks are quite common when building web apps in Elm with Browser.application!

What is a URL?

A URL is defined by Tim Berners-Lee in this document. It is worth reading, but I will try to share some highlights. He shares an example like this:

  https://example.com:8042/over/there?name=ferret#nose
  \___/   \______________/\_________/ \_________/ \__/
    |            |            |            |        |
  scheme     authority       path        query   fragment

And here are some facts that I found surprising:

  • ASCII — The spec only talks about ASCII characters. Behavior with other encodings is unspecified, so if you use a UTF-8 character directly, it may be handled differently by browsers, packages, and servers! No one is wrong. It is just unspecified. So I would stick to ASCII to be safe.
  • Escaping — There are some reserved characters in the spec, like /, ?, and #. So what happens when you need those in your query? The spec allows you to “escape” characters (/ => %2F, ? => %3F, # => %23) so it is clearly not a reserved characters anymore. The spec calls this percent-encoding. The basic idea is to look up the hex code in the ASCII table and put a % in front. There are many subtleties though, so I recommend reading this for more details!

Note: The difference between a URI and a URL is kind of subtle. This post explains the difference nicely. I decided to call this library elm/url because it is primarily concerned with HTTP which does need actual locations.

Related Work

The API in Url.Parser is quite distinctive. I first saw the general idea in Chris Done’s formatting library. Based on that, Noah and I outlined the API you see in Url.Parser. Noah then found Rudi Grinberg’s post about type safe routing in OCaml. It was exactly what we were going for. We had even used the names s and (</>) in our draft API! In the end, we ended up using the “final encoding” of the EDSL that had been left as an exercise for the reader. Very fun to work through!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].