I've added a few Actions on top of the CRUD ones, and I want to have custom routes to the new actions. But still, keep the CRUD actions with the same route (e.g. /ShowPost?postId=[uuid]
instance HasPath PostsController where
-- ...
pathTo ShowPostAction { postId } = "/ShowPost?postId=" ++ tshow postId
instance CanRoute PostsController where
parseRoute' = do
let posts = do
string "/Posts"
optional "/"
endOfInput
pure PostsAction
let showPost = do
string "/ShowPost?postId="
postId <- parseId
optional "/"
endOfInput
pure ShowPostAction { postId }
posts <|> showPosts -- ...
I assume the CanRoute
part isn't parsing correctly, as I end up with a 404 page when navigating to /ShowPost?postId=...