purescript-payload icon indicating copy to clipboard operation
purescript-payload copied to clipboard

Allow overriding default responses (404, 400, etc)

Open easafe opened this issue 4 years ago • 2 comments

Hello, great work with the library. Is it possible to set the 404 response when none of the routes match?

easafe avatar Aug 19 '20 10:08 easafe

You can make a catch-all route, e.g. GET "/<..unmatched>", that would catch all unmatched GET requests, and then return what you want from there. Of course, you would need to duplicate it for each HTTP method. Does this work for your use case or is there still need for something more specific?

hoodunit avatar Aug 20 '20 06:08 hoodunit

I suppose this works fine for the simple need of sending back some html. Was just wondering if I missed something, thanks!

easafe avatar Aug 20 '20 06:08 easafe