The correct way to modify the routing behaviour is by using wrapSite
:
wrapSite (\site -> site <|> writeBS "Use your custom 404 handler" )
In the example code, you can add this line in your base Initializer. In Snap Init code, it would be in the do
from app
function.
Also ""
will match for any route given. Example:
routes = [ ("/login", with auth handleLoginSubmit)
, ("/logout", with auth handleLogout)
, ("/new_user", with auth handleNewUser)
, ("/static", serveDirectory "static")
, ("", writeBS "This if none of the others" )
]
You can change the handler for ""
to be your custom 404.