Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/diogo405/express-mongo-rest-sample
https://github.com/diogo405/express-mongo-rest-sample
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/diogo405/express-mongo-rest-sample
- Owner: diogo405
- Created: 2020-07-31T00:35:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T13:00:55.000Z (almost 2 years ago)
- Last Synced: 2023-03-22T16:56:17.081Z (almost 2 years 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).