Recently when I do the project, I found when the URL was not defined. I get the 404 response with html formatting, like this:
< !DOCTYPE html>
< html lang="en">
< head>
< meta charset="utf-8">
< title>Error
< /head>
< body>
< pre>Cannot GET /api/response/v1.0/test
< /body>
< /html>
But I need the JSON formatting, for example:
{
statusCode: 404,
message: Cannot GET /api/response/v1.0/test
}
is there have some way that I can define the json formatting?
prompt reply is greatly appreciated.
Recently when I do the project, I found when the URL was not defined. I get the 404 response with html formatting, like this: < !DOCTYPE html> < html lang="en"> < head> < meta charset="utf-8"> < title>Error < /head> < body> < pre>Cannot GET /api/response/v1.0/test < /body> < /html>
But I need the JSON formatting, for example: { statusCode: 404, message: Cannot GET /api/response/v1.0/test } is there have some way that I can define the json formatting? prompt reply is greatly appreciated.