Demonstration user profile service in NodeJS
- NodeJS REST API server using ExpressJS
- Persistance layer backed by MongodDB
- Live API fetch from api.weather.gov
Service is assembled using docker compose to run a local mongodb instance alongside the application.
docker compose up --build
curl 'localhost:8085/api/v1.0/user' -X GET
[
{
"id": 9c80cfc4-3a1b-49d7-abca-1c1ecb765eed",
"name": {
"first": "Pat",
"last": "Person",
},
"interests": [],
"geolocation": {
"latitude": 39.7456,
"longitude": -97.0892
},
"weather":
"city": "Linn",
"state": "KS",
"temperature": 72.1
}
}
]
curl 'localhost:8085/api/v1.0/user' -X POST -d '{"name":{"first": "Jane", "last": "Doe"}, "geolocation": {"latitude":42.436113,"longitude":-82.729413}}'
docker exec -it usernode-mongo-1 mongo