Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.04 KB

File metadata and controls

63 lines (45 loc) · 1.04 KB

minimal.js

A minimal usage example of @oada/error within an Express server.

Starting the example

yarn install
yarn run minimal

Using the example

There are at least two ways to observe the minimal example running:

  1. Web Browser
  2. curl

Web Browser

Navigate a web browser to http://localhost:3000/forbidden

curl

Run

curl -v -X GET localhost:3000/forbidden

to 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."
}