A RESTful API that creates, deletes, updates and gets data about cars. The database used is Mongo DB.
Clone the project
git clone https://github.com/tawfeeqm/case-study-typescript.gitGo to the project directory
cd case-studyRun this command
docker compose upAfter the server has started, use the API references below to make API calls to the server.
| Response Payload | Type | Description |
|---|---|---|
code |
int |
HTTP error code |
msg |
str |
Error message |
POST http://localhost:5000/v1/api/cars| Request Payload | Type | Format | Description |
|---|---|---|---|
brand |
str |
string |
Required |
model |
str |
string |
Required |
manufactureYear |
string |
Required | |
engineSize |
int |
Required | |
color |
string |
Required | |
price |
int |
Required |
| Response Payload | Type | Format | Description |
|---|---|---|---|
code |
num |
201 |
Created, no data returned |
Error object
GET http://localhost:5000/v1/api/cars| Request Payload | Type | Format | Description |
|---|---|---|---|
| - | - | - | - |
Array of objects:
| Response Payload | Type | Format | Description |
|---|---|---|---|
brand |
str |
string |
Required |
model |
str |
string |
Required |
manufactureYear |
str |
date |
Required |
engineSize |
int |
any |
Required |
color |
string |
any |
Required |
price |
int |
any |
Required |
Error object
GET http://localhost:5000/v1/api/cars/:id| Request Payload | Type | Format | Description |
|---|---|---|---|
| - | - | - | - |
| Response Payload | Type | Format | Description |
|---|---|---|---|
brand |
str |
string |
Required |
model |
str |
string |
Required |
manufactureYear |
str |
date |
Required |
engineSize |
int |
any |
Required |
color |
string |
any |
Required |
price |
int |
any |
Required |
Error object
PUT http://localhost:5000/v1/api/cars/:id/price| Request Payload | Type | Format | Description |
|---|---|---|---|
price |
int |
any |
Required |
| Response Payload | Type | Format | Description |
|---|---|---|---|
code |
num |
204 |
Updated, no data returned |
Error object
DELETE http://localhost:5000/v1/api/cars/:id| Request Payload | Type | Format | Description |
|---|---|---|---|
| - | - | - | - |
| Response Payload | Type | Format | Description |
|---|---|---|---|
code |
num |
204 |
Updated, no data returned |
Error object