An simple RESTful API that provides the required endpoints to create, list and delete users and their hobbies.
- Node.js
- Docker
- MongoDB
- TypeScript
- Mongoose
- Express.js
- Swagger
- Mocha
The API runs by default on port 3000
under the base path /api/v1
and exposes the following endpoints:
/
- Redirects to the SwaggerUI/api-docs
- The SwaggerUI/api/v1/users
- POST and GET operations for users/api/v1/users/{userId}
- GET and DELETE operations for the specified user/api/v1/users/{userId}/hobbies
- POST and GET operations for users' hobbies/api/v1/users/{userId}/hobbies/{hobbyId}
- GET and DELETE operations for the specified user's hobby
In order to run or test the API, it is needed to have Node.js, Docker and Docker Compose installed.
- Install dependencies with
npm install
- Compile the project with
npm run tsc:build
- Start the MongoDB instance with
make start-db
- Start the application by running
npm start
- Install dependencies with
npm install
- If not done already - Start the application by running
npm test
Currently in order to run the tests, it is needed to have the MongoDB instance running, since the tests are Integration Tests and not Unit Tests. To fix this issue there is needed to have an in memory database that allows to perform the same opeation supported by MongoDB.