A minimal usage example of @oada/error within an Express server.
yarn install
yarn run minimalThere are at least two ways to observe the minimal example running:
- Web Browser
- curl
Navigate a web browser to http://localhost:3000/forbidden
Run
curl -v -X GET localhost:3000/forbiddento generate the following:
Request:
GET /forbidden HTTP/1.1
User-Agent: curl/7.35.0
Host: localhost:3000
Accept: */*Response:
HTTP/1.1 403 Forbidden
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 226
ETag: W/"e2-54891415"
Date: Wed, 15 Oct 2014 20:46:47 GMT
Connection: keep-alive
{
"code": 403,
"status": "Forbidden",
"title": "Example Forbidden OADA Error",
"href": "https://github.com/OADA/oada-docs/blob/master/rest-specs/README.md",
"userMessage": "You do not have access to this resource."
}