Best way to return JSON for 404 etc
See original GitHub issueInformations
Type | Version |
---|---|
Question | 4.x |
Description
Express default error handling responds with the below.
Cannot GET /
I want to convert this to a JSON response but I am unable to add a errorHandler in the ServerLoader-$afterRoutesInit. Can you please advise?
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Best way to return JSON for 404 etc · Issue #433 · tsedio/tsed
To customize 404, we just have to register a new middleware on $afterRouteInit (or $onServerReady) hook. $afterRoutesInit in the ts.ed lifecycle ...
Read more >How do I return json for 404s and 403s in WebAPI?
Open Visual Studio 2013 Update 4 · New Project · Choose . · Choose Templates > Visual C# > Web > ASP.NET Web...
Read more >Return json response for only API 404 error - Laracasts
I have exposed the API of a laravel 5.7 application. My goal is to return json response for all API calls that results...
Read more >HTTP status and error codes for JSON | Cloud Storage
Error responses usually include a JSON document in the response body, ... Example values include: 400 (Bad Request), 401 (Unauthorized), and 404 (Not...
Read more >Problem Details - The right way to specify errors in Web API ...
For the 404 wherein the route didn't match, there isn't much you can do, but for scenarios where you want to return "Not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello I’ve added a working example on the website: http://tsed.io/tutorials/not-found-page.html
See you, Romain
Yes sir 😉