/nodejs-hw2.1

Primary LanguageJavaScript

Manual

You need installed MongoDB.

Running project

Install packages

# in project's folder
npm install

Run server

node index.js

Make Requests

API status:

http GET http://localhost:3001/api/

Get all users:

http GET http://localhost:3001/api/users/all

Get user by id:

http GET http://localhost:3001/api/users
id = 1

Inset your new user:

http POST http://localhost:3001/api/users  
id = 1 name = "Cat" username = "FatCat"

Delete user by _id

http DELETE http://localhost:3001/api/users  
_id = "5a9ec9bdc3f0ce526026513d"

Update your user data:

http PUT http://localhost:3001/api/users  
_id = "5a9ec9bdc3f0ce526026513d" name = "Pavel" username = "FatCat"