elm-community / elm-route Goto Github PK
View Code? Open in Web Editor NEWA library for parsing routes.
Home Page: http://package.elm-lang.org/packages/elm-community/elm-route/latest
License: BSD 3-Clause "New" or "Revised" License
A library for parsing routes.
Home Page: http://package.elm-lang.org/packages/elm-community/elm-route/latest
License: BSD 3-Clause "New" or "Revised" License
Hello,
Now I have something like this:
articleListR = ArticleListPage := "articles" <//> static ""
articleDetailR = ArticleDetilPage := "articles" <//> int
articleCreateR = ArticleCreatePage := "articles" <//> static "create"
articleUpdateR = ArticleUpdatePage := "articles" <//> int <> "update"
articleDeleteR = ArticleDeletePage := "articles" <//> int <> "delete"
If I add users, groups etc. to my app, you can guess how it would look like. My Page
type looks like this:
type Page
= ArticleListPage ()
| ArticleDetilPage Int
| ArticleCreatePage ()
| ArticleUpdatePage Int
| ArticleDeletePage Int
And here the same story, this kind of flat sitemap is going to grow fast in real (big) application. I would like to define listR
, detailR
, createR
, updateR
and deleteR
like this:
listR = ListPage := static ""
detailR = DetailPage := int
createR = CreatePage := static "create"
updateR = UpdatePage := int <> "update"
deleteR = DeletePage := int <> "delete"
and then reuse them. I would like to define one route for each submodule of my app like:
articleR = ArticlePages := "articles"
userR = UserPages := "users"
groupR = GroupPages := "groups"
and the I would like to combine them as I need, for example:
route (articleR <//> listR) [] ==> "/articles/"
route (userR <//> updateR) [1] ==> "/users/1/update/"
My new Page
type would look something like this:
type BasicPage
= ListPage ()
| DetailPage Int
| CreatePage ()
| UpdatePage Int
| DeletePage Int
type Page
= ArticlePage BasicPage
| UserPage BasicPage
| GroupPage BasicPage
Is it possible to do something like this with current version? And if yes, then how?
The link to Route.elm
works when looking at the readme on github, but not when on the Elm packages site.
This is blocked by elm-community/elm-history#17
I noticed with the repo change, the package itself isn't published to elm-community/elm-route
. I'm new to the Elm community, will it be moved to the package namespace at some point? If so, I can make a pull request to update the readme ๐
Thanks for the project! It's been great to have this library to think about how to structure routes.
I'm currently working on a multi lingual app where I have routes such as:
/en/about
/jp/about
I would like them to resolve to the same route: aboutR
, or to have this route defined as a wildcard on the path /*/about
.
Do you have any advice on this?
Thanks!
Hi, I've been trying to create a route of en/about
.
I tried this:
aboutEnR : Route Sitemap
aboutEnR =
AboutEnR := static "en/about"
and:
aboutEnR : Route Sitemap
aboutEnR =
AboutEnR := static "en" </> static "about"
Neither produce any output at that route, it is not realised. Could you point me to docs where something like this is defined, or let me know what I'm doing wrong. I see posts/<int>
etc., but not this simple static case. Thanks
Hi, I'm still fairly new to Elm so please excuse me if this is an issue my end, but when I try to use this package I get this compiler error on 0.17.1
:
Error: Compiler process exited with error Compilation failed
Problem in dependency Bogdanp/elm-route 3.0.2
The elm-package.json constraints of 'Bogdanp/elm-route' are probably
letting too much stuff through. Definitely open an issue on the relevant github
repo to get this fixed and save other people from this pain.
In the meantime, take a look through the direct dependencies of the broken
package and see if any of them have had releases recently. If you find the new
thing that is causing problems, you can artificially constrain things by adding
some extra constraints to your elm-package.json as a stopgap measure.
Detected errors in 1 module.
Hello !
First of all nice job for this package ! ๐
There is an error within the README.md where the example mix up Route the module with Route the type with SiteMap the undefined type. And the match function in Route vs. Routes modules in the end is confusing as well (Routes isn't defined anywhere as well). I don't know how you would rather named them so I didn't proposed a PR but these details bugged me for a while.
Thanks again for your great work !
Regards,
Camille
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.