1.1.0 • Published 5 years ago

generator-lazy-backend v1.1.0

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

generator-lazy-backend

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

Video exemple

Fail to load the video

About the project

Database

The project is using MongoDB as its database

HTTP Request Handling

The project is using ExpressJS as its Request Handling

Where the project can be used

The focus is to use for small objectives

Prerequisites

Yeoman

  • You need to have yeoman installed. If you don't have it, type the following command:
npm i -g yo

Database

  • 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

Installation

You can install the package from npm

npm i -g generator-lazy-backend

Usage

run the generator

yo lazy-backend

After the project creation

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

Entity Generator

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

Project struct

+ 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

Project Dependencies

  1. bcrypt
    • Responsible for encrypting the user's password
    • Only added if you add JWT validations
    • npm
  2. jsonwebtoken
    • Makes possible to create a JWT Token
    • Only added if you add JWT validations
    • npm
  3. dotenv
    • Permit the posibilite to use environment variables
    • npm
  4. express
    • Handles HTTP requests
    • npm
  5. 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

    • npm
  6. express-validation
    • Use the joi validations, if the validation fails a response with error is returned
    • npm
  7. joi
    • Responsible to validate the fields
    • npm
  8. mongoose
    • MongoDB ODM for NodeJS
    • npm
  9. mongoose-paginate
    • Do the pagination
    • npm
  10. require-dir
    • Reduce the amount of require() you will make
    • npm
  11. youch
    • Makes NodeJS' error more readable
    • npm

Dev-Dependencies

  1. eslint
    • Lint the code
    • Use the standard configuration
    • npm
  2. nodemon - Restarts the application when a file change occurs - npm

    Author

    Mateus Gomems da Silva Cardoso | mateus7532@gmail.com
1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago