Example API rest using NodeJs
- cors : ^2.8.5
- express : ^4.17.1
- mongoose : ^5.9.17
- mongoose-paginate : ^5.0.3
- require-dir: ^1.2.0
Clone project https://github.com/vitorghcnodejs-restapi.git
.
docker mongodb pull docker run --name mongodb -p 27017:27017 -d mongo
npm run dev
POST localhost:3001/api/products body:
{
"title": "E-book Nodejs",
"description": "Nodejs for dummies",
"url": "http://www.node.org"
}
GET localhost:3001/api/products GET localhost:3001/api/products?page=1
GET localhost:3001/api/products/{id}
PUT localhost:3001/api/products body:
{
"title": "E-book Nodejs"
}
DELETE localhost:3001/api/products/{id}