This repository contains a simple demo API built with NodeJS. The API is used to manage users in a MongoDB database.
This application was developed using ExpressJS. MongoDB was used for persisting data with Mongoose as ORM.
- Ensure that you've
node
installed. If not, download it here: https://nodejs.org/en/download/ - Ensure that you've
docker
installed. If not, download it here: https://docs.docker.com/engine/installation/ - Ensure that you've
docker-compose
installed. If not, get it here: https://docs.docker.com/compose/gettingstarted/ - Start up your terminal (or Command Prompt on Windows OS).
- Navigate to the project folder using
cd UserManager
on your terminal (or command prompt) - Finally, run
docker-compose up
.
To ensure that your installation is successful you'll need to run tests.
The command: npm test
makes this possible. It isn't functional right now, but once it's done you'll be notified via the README.
The API only has one endpoint which is the /users
endpoint for saving users to the database. The endpoint works with the HTTP verbs: POST
, GET
, PUT
, DELETE
.
POST
/users- INPUT:
name: John Doe
email: john.doe@gmail.com
password: johndoe
- HTTP Status:
201: created
- JSON data
{
"_id": "59071791b0lkscm2325794",
"name": "John Doe",
"email": "john.doe@gmail.com",
"password": "johndoe",
"__v": 0
}
GET
/users
[
{
"_id": "59071791b0lkscm2325794",
"name": "John Doe",
"email": "john.doe@gmail.com",
"password": "johndoe",
"__v": 0
}
]
GET
/users/:id
{
"_id": "59071791b0lkscm2325794",
"name": "John Doe",
"email": "john.doe@gmail.com",
"password": "johndoe",
"__v": 0
}
DELETE
/users/:id
User John Doe was deleted
PUT
/users/:id- INPUT:
name: Jane Doe
email: jane.doe@gmail.com
password: janedoe
- HTTP Status:
200: OK
- JSON data
{
"_id": "59071791b0lkscm2325794",
"name": "Jane Doe",
"email": "jane.doe@gmail.com",
"password": "janedoe",
"__v": 0
}
Olajide Bolaji 'Nuel - Software Developer at Andela