Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moathshraim/nodejs-rest-api-project-structure-express
Nodejs project structure practices for building RESTful APIs using Express framework and MongoDB.
https://github.com/moathshraim/nodejs-rest-api-project-structure-express
express expressjs javascript jwt-authentication mongodb mongoose nodejs restful-api
Last synced: about 24 hours ago
JSON representation
Nodejs project structure practices for building RESTful APIs using Express framework and MongoDB.
- Host: GitHub
- URL: https://github.com/moathshraim/nodejs-rest-api-project-structure-express
- Owner: MoathShraim
- Created: 2019-11-05T09:51:29.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T12:58:41.000Z (about 2 years ago)
- Last Synced: 2025-01-20T06:10:26.601Z (about 24 hours ago)
- Topics: express, expressjs, javascript, jwt-authentication, mongodb, mongoose, nodejs, restful-api
- Language: JavaScript
- Homepage:
- Size: 103 KB
- Stars: 353
- Watchers: 16
- Forks: 143
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js, Express and MongoDB Project Structure
This is a basic project structure to help you to start building your own RESTful web APIs (for Android, IOS, or JavaScript framworks) using Express framework and MongoDB with a good structure practices based on clean MVC Architecture.# Features
- Fundamental of Express: routing, middleware, sending response and more
- Fundamental of Mongoose: Data models, data validation and middleware
- RESTful API including pagination,sorting and limiting fields
- CRUD operations with MongoDB
- Security: encyption, sanitization and more
- Authentication with JWT : login and signup
- Authorization (User roles and permissions)
- Error handling
- Enviroment Varaibles
- handling error outside Express
- Catching Uncaught Exception# Project Structure
- server.js : Responsible for connecting the MongoDB and starting the server.
- app.js : Configure everything that has to do with Express application.
- config.env: for Enviroment Varaiables
- routes -> userRoutes.js: The goal of the route is to guide the request to the correct handler function which will be in one of the controllers
- controllers -> userController.js: Handle the application request, interact with models and send back the response to the client
- models -> userModel.js: (Business logic) related to business rules, how the business works and business needs ( Creating new user in the database, checking if the user password is correct, validating user input data)