- NodeJs
- TypeScript
Install all necessary dependencies
$ npm install
Start the server (Development Environment only)
$ npm run dev
API to do basic CRUD Operations:
-
Create a new Product
Request URL
POST /api/products/
Request Object (application/json)
{ "id": 1, "name": "Transcof", "cost": 10.10, "currency": "Dollar", "appVersion": "0.49", "country": "United States" }
Response
{ "description": "New Product created", "content": { "name": "Quo Lux 2", "cost": 992.52, "currency": "Dollar", "appVersion": "23.2.3", "country": "United States", "id": 11 } }
-
Read all Products or get a Product by
id
All Products
GET /api/products/
For a single Product
GET /api/products/:id
Request Object (application/json)
{ "name": "Transcof", "cost": 10.10, "currency": "Dollar", "appVersion": "0.49", "country": "United States" }
Response
[ { "description": "New Product created", "content": { "id": 11, "name": "Transcof", "cost": 10.10, "currency": "Dollar", "appVersion": "0.49", "country": "United States" } }, ... ]
-
Update a single Product, Provide only the necessary fields to update
All Products
PATCH /api/products/:id
For a single Product
GET /api/products/:id
Request Object(application/json)
{ "name": "Transcof", "cost": 10.10, "currency": "Dollar", "appVersion": "0.49" }
Response
{ "description": "Updated Product 1", "content": { "id": 1, "name": "Quo Lux 2", "cost": 992.52, "currency": "Dollar", "appVersion": "23.2.3", "country": "United States", } }
-
Delete a single Product
DELETE /api/products/:id
Response
{ "description": "Resource 2 deleted", "content": { "id": 2 } }