Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miyamoen/elm-route-builder
Builder for Route that has URL parser and URL builder.
https://github.com/miyamoen/elm-route-builder
elm
Last synced: 20 days ago
JSON representation
Builder for Route that has URL parser and URL builder.
- Host: GitHub
- URL: https://github.com/miyamoen/elm-route-builder
- Owner: miyamoen
- License: bsd-3-clause
- Created: 2020-12-26T09:59:19.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-16T15:28:45.000Z (almost 4 years ago)
- Last Synced: 2024-11-10T04:13:33.286Z (3 months ago)
- Topics: elm
- Language: Elm
- Homepage: https://package.elm-lang.org/packages/miyamoen/elm-route-builder/latest/
- Size: 36.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
elm-route-builder let us define both URL builder and parser at once.
I have no MP to write document. ワタシ ニホンジン. エイゴ ニガテ
```elm
type alias BookIds =
{ libraryId : String, bookId : String }bookRoute : Route BookIds page
bookRoute =
root |> s "libraries" |> string .libraryId |> s "books" |> string .bookId |> dynamic BookIdsbookUrl : String
bookUrl =
bookRoute.toString { libraryId = "図書館", bookId = "本" }bookParser : Url.Parser.Parser (BookPageModel -> BookPageModel) BookPageModel
bookParser =
bookRoute.toParser bookPageInittype alias BookPageModel =
{ ids : BookIds }bookPageInit : BookIds -> BookPageModel
bookPageInit ids =
{ ids = ids }
```