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.
- Download and install Docker on your machine
- Clone the app
- Open Docker Terminal and navigate to the app
- Build the app image using
docker build -t serverapp . - Run the app and db containers using
docker-compose -f ./docker-compose.yml up - :)
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: [email protected]
password: johndoe
- HTTP Status:
201: created - JSON data
{
"_id": "59071791b0lkscm2325794",
"name": "John Doe",
"email": "[email protected]",
"password": "johndoe",
"__v": 0
}GET/users
[
{
"_id": "59071791b0lkscm2325794",
"name": "John Doe",
"email": "[email protected]",
"password": "johndoe",
"__v": 0
}
]GET/users/:id
{
"_id": "59071791b0lkscm2325794",
"name": "John Doe",
"email": "[email protected]",
"password": "johndoe",
"__v": 0
}DELETE/users/:id
User John Doe was deletedPUT/users/:id- INPUT:
name: Jane Doe
email: [email protected]
password: janedoe
- HTTP Status:
200: OK - JSON data
{
"_id": "59071791b0lkscm2325794",
"name": "Jane Doe",
"email": "[email protected]",
"password": "janedoe",
"__v": 0
}