A simple crud rest api using express
npm install
You need to change these files with your preferences.
npm run typeorm migration:run
runs on port 3333
npm run start
POST /users/
{
"name": "John Doe"
"email": "johndoe@john.com"
"password": "john123"
}
{
"id": "1933g11b-ad28-49e9-b0c5-54e402fe2d09",
"name": "John Doe",
"email": "johndoe@john.com",
"created_at": "2020-12-20T00:21:45.167Z",
"updated_at": "2020-12-20T00:21:45.167Z"
}
POST /sessions/
{
"email": "johndoe@john.com"
"password": "john123"
}
{
"user": {
"id": "89c0f2b5-8707-4560-948c-480899ba460d",
"name": "John Doe",
"email": "johndoe@john.com",
"created_at": "2020-12-20T00:21:20.846Z",
"updated_at": "2020-12-20T00:21:20.846Z"
},
"token": "eyJhbGciOiJIUzI1NiI1sI3nR5dCI6IkpXVCJ9.eyJpYXQiOjE2MDg0MTfdI4OTcsImV4cCI6MTYwODQ5ONywic3ViIjoiODlgDjMGYyYjUtODcwNy00NTYwLTk0OGMtNDgwODk5YmE0NjBkIn0.uRlIsOEt7ubwBEm0LJIBTO52JKBISY-Jrr_Tc8DjK3ysGk"
}
GET /products/
no body
{
"products": [
{
"id": "6f4e52f1-38ed-40cf-acc4-f2ecec625c73",
"name": "Cetaphil's Purifying Clay Mask",
"value": 59.99,
"created_at": "2020-12-20T00:56:43.146Z",
"updated_at": "2020-12-20T00:56:43.146Z"
},
{
"id": "96101375-99a6-4af9-9d55-497479610816",
"name": "Scum Grime Remover",
"value": 20.99,
"created_at": "2020-12-20T00:58:00.059Z",
"updated_at": "2020-12-20T00:58:00.059Z"
}
],
"page": 1,
"per_page": 10
}
GET /products/:id
no body
{
"id": "6f4e52f1-38ed-40cf-acc4-f2ecec625c73",
"name": "Cetaphil's Purifying Clay Mask",
"value": 59.99,
"created_at": "2020-12-20T00:56:43.146Z",
"updated_at": "2020-12-20T00:56:43.146Z"
},
POST /products/
{
"name": "Cetaphil's Purifying Clay Mask",
"value": 59.99,
}
{
"name": "Cetaphil's Purifying Clay Mask",
"value": 59.99,
"id": "96101375-99a6-4af9-9d55-497479610816",
"created_at": "2020-12-20T00:58:00.059Z",
"updated_at": "2020-12-20T00:58:00.059Z"
}
PUT /products/:id
{
"name": "Adorable Plushie",
"value": 29.99,
}
{
"id": "198d6871-359b-44b8-8db9-0eef0355c82f",
"name": "Adorable Plushie",
"value": 29.99,
"created_at": "2020-12-20T00:04:41.821Z",
"updated_at": "2020-12-20T00:11:18.476Z"
}
DELETE /products/:id
no body
no body