https://github.com/diogo405/express-mongo-rest-sample
https://github.com/diogo405/express-mongo-rest-sample
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/diogo405/express-mongo-rest-sample
- Owner: diogo405
- Created: 2020-07-31T00:35:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T13:00:55.000Z (over 2 years ago)
- Last Synced: 2025-01-07T23:55:35.088Z (5 months ago)
- Language: JavaScript
- Size: 204 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# express-mongo-rest-sample
A sample REST API using Node.js (Express) + MongoDB. It has all CRUD operations for a user entity ({"name": "Ayrton Senna"}).## Architecture
The entry point is app.js which init the routes and the server. A request to the API has the flow "route -> service -> database".E.g. GET /user
request -> userRoutes -> userService -> Mongodb.All responses are wrapped in the ApiResponse class (id, success, payload, error). And all errors wrapped in the ApiError class.
Lastly, there's a exception handler to deal with uncaught errors (routes/handler.js).