This is a Readme file, every repository will have one, it explains details about the repository, about the technologies used in it, as well as details about the service and the API it has to communicate with the outside world.
- Clone the repo
git clone git@github.com:altooro/express-demo-server.git- Run using docker compose
docker-compose up-
The server has the following endpoints:
-
GET:/--> which returns the message "Welcome to demo express server" -
GET:/users--> This returns a map with our fake users -
GET:/user/{id}--> This returns a specific users from our map based on theid: To use it you need to send anidin the GET request:users/1If theidexists you will get their details:{ "name": "John Doe", "age": 25 } -
POST:/users/{id}--> This request adds a user to our map: To use it, you need to send anidin the URL like:users/4Then also send a request body in the following structure:{ "name": "Jane Doe", "age": 25 }
-
-
Our map initially when running the service starts with the following values:
{
"1": { "name": "John Doe", "age": 25 },
"2": { "name": "Elizabeth Windsor", "age": 90 }
}