Starter project for a REST API with Node.js, Express & MongoDB
- Git
- Node.js and npm Node 10.15.2, npm 6.4.1
- MongoDB - Keep a running daemon with
mongod
- bcryptjs : ^2.4.3
- body-parser : ^1.18.3
- cookie-parser : ~1.4.3
- debug : ~2.6.9
- express : ~4.16.0
- http-errors : ~1.6.2
- moment : ^2.24.0
- mongoose : ^5.4.10
- mongoose-unique-validator : ^2.0.2
- morgan : ~1.9.0
$ git clone https://github.com/trionoputra/express-mongoose-rest-api.git
$ cd express-mongoose-rest-api
$ npm install
$ npm start
Get all users.
- Method:
GET
- URL:
http://localhost:3000/user
Create a new user.
- Method:
POST
- URL:
http://localhost:3000/user
- Body:
{
"id": "1",
"name": "Trionoputra"
"password": "123456"
}
Get user with specific id.
- Method:
GET
- URL:
http://localhost:3000/user/1
Update entire user with specific id.
- Method:
PUT
- URL:
http://localhost:3000/user/1
- Body:
{
"name": "Triono putra"
"password": "1234567890"
}
Delete user with specific id.
- Method:
DELETE
- URL:
http://localhost:3000/user/1