A simple generator to create a backend using NodeJS, Express.js and Mongoose
This generator is highly inspired by JHipster
There is an entity generator available as well
The project is using MongoDB as its database
The project is using ExpressJS as its Request Handling
The focus is to use for small objectives
- You need to have yeoman installed. If you don't have it, type the following command:
npm i -g yo
- You need to have MongoDB running to be able to start the project after creation, but IT'S NOT REQUIRED WHEN CREATING THE PROJECT
- If you have Docker installed you can download a mongo image, just type the following command
docker run --name mongodb -p 27017:2017 -d -t mongo
You can install the package from npm
npm i -g generator-lazy-backend
yo lazy-backend
Just type the following command
npm start
Remember to have MongoDB started
The MongoDB port by default is 27017, if you use a diferent port you can change it on .env file
This generator creates only the base project. There is an entity generator available for you.
You can install the package from npm
npm i -g generator-lazy-backend-entity
You can access it's GitHub to learn how to use it
[+] indicates that it is a folder
|-- Project-Name[+]
|-- src[+]
|-- app[+]
|-- controllers[+]
|-- middlewares[+]
|-- models[+]
|-- validators[+]
|-- config[+]
|-- index.js
|-- routes.js
|-- server.js
|-- package.json
|-- package-lock.json
|-- .editorconfig
|-- .env
|-- .eslintrc.json
|-- .gitignore
If you want to check how the genereted project is, you can check this github
- bcrypt
- Responsible for encrypting the user's password
- Only added if you add JWT validations
- npm
- jsonwebtoken
- Makes possible to create a JWT Token
- Only added if you add JWT validations
- npm
- dotenv
- Permit the posibilite to use environment variables
- npm
- express
- Handles HTTP requests
- npm
- express-async-handler
- As described by the developers:
Simple middleware for handling exceptions inside of async express routes and passing them to your express error handlers
- express-validation
- Use the joi validations, if the validation fails a response with error is returned
- npm
- joi
- Responsible to validate the fields
- npm
- mongoose
- MongoDB ODM for NodeJS
- npm
- mongoose-paginate
- Do the pagination
- npm
- require-dir
- Reduce the amount of require() you will make
- npm
- youch
- Makes NodeJS' error more readable
- npm
- eslint
- Lint the code
- Use the standard configuration
- npm
- nodemon
- Restarts the application when a file change occurs
- npm
Mateus Gomems da Silva Cardoso | mateus7532@gmail.com