Emanuel Koczwara
unread,Dec 1, 2015, 9:15:06 AM12/1/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Snap Framework
Hello,
I'm trying to use snap-web-routes and I see problem with parent/child relationships on my pages. Here is my url type:
> data AppUrl
> = AreaList
> | AreaCreate
> | AreaDetail Integer
> | AreaUpdate Integer
> | AreaDelete Integer
> | AreaMobileIndexUp Integer
> | AreaMobileIndexDown Integer
> | TableCreate Integer
> | TableUpdate Integer Integer
> | TableDelete Integer Integer
> | TableMobileIndexUp Integer Integer
> | TableMobileIndexDown Integer Integer
> | ProductGroupList
> | ProductGroupCreate
> | ProductGroupDetail Integer
> | ProductGroupUpdate Integer
> | ProductGroupDelete Integer
> | ProductList
> | ProductCreate
> | ProductDetail Integer
> | ProductUpdate Integer
> | ProductDelete Integer
> deriving (Eq, Show, Read, Generic)
It is a fraction of what I actually have in my application. This works quite well and I get:
/area-list
/area-create
/area-detail/<Integer>
/area-update/<Integer>
/area-delete/<Integer>
/area-mobile-index-up/<Integer>
/area-mobile-index-down/<Integer>
/table-create/<Integer>
/table-update/<Integer>/<Integer>
/table-delete/<Integer>/<Integer>
/table-mobile-index-up/<Integer>/<Integer>
/table-mobile-index-down/<Integer>/<Integer>
/product-group-list
/product-group-create
/product-group-detail/<Integer>
/product-group-update/<Integer>
/product-group-delete/<Integer>
/product-list
/product-detail/<Integer>
/product-update/<Integer>
/product-delete/<Integer>
It works, but it produces very flat sitemap. I would like to have instead:
/areas
/areas/create
/areas/<Integer>
/areas/<Integer>/update
/areas/<Integer>/delete
/areas/<Integer>/mobile-index-up
/areas/<Integer>/mobile-index-down
/areas/<Integer>/tables/create
/areas/<Integer>/tables/<Integer>/update
/areas/<Integer>/tables/<Integer>/delete
/areas/<Integer>/tables/<Integer>/mobile-index-up
/areas/<Integer>/tables/<Integer>/mobile-index-down
/product-groups
/product-groups/create
/product-groups/<Integer>
/product-groups/<Integer>/update/
/product-groups/<Integer>/deleted/
/products
/products/create
/products/<Integer>
/products/<Integer>/update
/products/<Integer>/delete
Another problem I see is composition of routes. Now I have:
> routes :: AppUrl -> Handler App App ()
> routes url = case url of
> (AreaList) -> Areas.Handlers.areaList
> (AreaCreate) -> Areas.Handlers.areaCreate
> (AreaDetail areaId) -> Areas.Handlers.areaDetail areaId
> (AreaUpdate areaId) -> Areas.Handlers.areaUpdate areaId
> (AreaDelete areaId) -> Areas.Handlers.areaDelete areaId
> (AreaMobileIndexUp areaId) -> Areas.Handlers.areaMobileIndexUp areaId
> (AreaMobileIndexDown areaId) -> Areas.Handlers.areaMobileIndexDown areaId
> (ProductGroupList) -> Products.Handlers.productGroupList
> (ProductGroupCreate) -> Products.Handlers.productGroupCreate
> (ProductGroupDetail productGroupId) -> Products.Handlers.productGroupDetail productGroupId
> (ProductGroupUpdate productGroupId) -> Products.Handlers.productGroupUpdate productGroupId
> (ProductGroupDelete productGroupId) -> Products.Handlers.productGroupDelete productGroupId
> (ProductList) -> Products.Handlers.productList
> (ProductCreate) -> Products.Handlers.productCreate
> (ProductDetail productId) -> Products.Handlers.productDetail productId
> (ProductUpdate productId) -> Products.Handlers.productUpdate productId
> (ProductDelete productId) -> Products.Handlers.productDelete productId
It is flat as my sitemap. I would like to put that in Areas.Routes and Products.Routes and include only these two in my Site.hs.
Or if I want to add some snaplet like forum or wiki, what if that snaplet doesn't use web-routes?
Can I mix type safe and others urls in my application?
Best Regards,
Emanuel