root > npm install
root > npm run dev
root > npm run build
root > npm start
The REST API to the example app is described below.
GET /
curl -i -H 'Accept: application/json' http://localhost:5000
HTTP/1.1 200 OK
Status: 200 OK
Connection: close
Content-Type: application/json
{ "message": "RESTful services it's working!" }
GET /api/product
curl -i -H 'Accept: application/json' http://localhost:5000/api/product
HTTP/1.1 201 Created
Status: 201 Created
Connection: close
Content-Type: application/json
Location: /thing/1
Content-Length: 36
[ { ... }, { ... }, { ... } ]
GET /api/product/:productId
curl -i -H 'Accept: application/json' http://localhost:5000/api/product/660adcc629cdc201eca6f073
HTTP/1.1 200 OK
Status: 200 OK
Connection: close
Content-Type: application/json
{ ... }
GET /api/product/alabala
curl -i -H 'Accept: application/json' http://localhost:5000/api/product/alabala
HTTP/1.1 404 Not Found
Status: 404 Not Found
Connection: close
Content-Type: application/json
{ "message": "Product not found" }
POST /api/product
curl -i -H 'Accept: application/json, X-Authorization: {token}' -d { ... } http://localhost:5000/api/product
HTTP/1.1 200 OK
Status: 201 OK
Connection: close
Content-Type: application/json
{ ... }
PUT /api/product/:productId
curl -i -H 'Accept: application/json, X-Authorization: {token}' -d {...} -X PUT http://localhost:5000/api/product/660adcc629cdc201eca6f073
HTTP/1.1 200 OK
Status: 200 OK
Connection: close
Content-Type: application/json
{ ... }
GET /api/product/:limit/limit/:page/page
curl -i -H 'Accept: application/json' http://localhost:5000/api/product/4/limit/3/page
HTTP/1.1 200 OK
Status: 200 OK
Connection: close
Content-Type: application/json
{ ... }
DELETE /api/product/:productId
curl -i -H 'Accept: application/json, X-Authorization: {token}' -X DELETE http://localhost:5000/api/product/660adcc629cdc201eca6f073
HTTP/1.1 200 OK
Status: 200 OK
Connection: close
Content-Type: application/json
{ ... }
POST /api/users/register
curl -i -H 'Accept: application/json' http://localhost:5000/api/users/register
HTTP/1.1 200 OK
Status: 201 OK
Connection: close
Content-Type: application/json
{ ... }
POST /api/users/login
curl -i -H 'Accept: application/json' http://localhost:5000/api/users/login
HTTP/1.1 200 OK
Status: 201 OK
Connection: close
Content-Type: application/json
{ ... }
GET /api/users/profile
curl -i -H 'Accept: application/json', X-Authorization: {token}' http://localhost:5000/api/users/profile
HTTP/1.1 200 OK
Status: 201 OK
Connection: close
Content-Type: application/json
{ ... }
GET /api/users/logout
curl -i -H 'Accept: application/json' http://localhost:5000/api/users/logout
HTTP/1.1 200 OK
Status: 204 OK
Connection: close
Content-Type: application/json
No response body!