I want the user to be able to visit myserver.com
and come to the index route.
And I want to show the list page when they visit myserver.com/pages
.
However if the user visits an invalid url such as myserver.com/invalidpath/blabla
it falls through to the indexPage
route.
I want to respond with a 404 page
when a invalid url is visited.
Here is an example of my routes:
1 routes :: ServerPart Response
2 routes = msum
3 [ dirs "pages/delete" $ delete
4 , dirs "pages/edit" $ edit
5 , dirs "pages/save" $ save
6 , dirs "pages" $ listPages
7 , indexPage]
What I thought about for now is that in my indexPage
function I can check the path if it contains anything or if it is empty. This way I can determine if the fall through is from an invalid url or a index page visit.
Is there a good way to do this?