# generator-lazy-backend

> A simple generator to create a backend using NodeJS, Express.js and Mongoose

Latest version **1.1.0** (published 2019-03-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install generator-lazy-backend
pnpm add generator-lazy-backend
yarn add generator-lazy-backend
bun add generator-lazy-backend
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-03-17 |
| First published | 2019-01-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 194.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Mateus Gomes da Silva Cardoso |
| Maintainers | under7 |
| Keywords | yeoman-generator, nodejs, express, backend, mongodb, mongoose |

## Links

- npm: https://www.npmjs.com/package/generator-lazy-backend
- Repository: https://github.com/UnDer-7/generator-lazy-backend
- Homepage: https://github.com/UnDer-7/generator-lazy-backend#readme
- Issues: https://github.com/UnDer-7/generator-lazy-backend/issues
- npm.io page: https://npm.io/package/generator-lazy-backend

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [bcrypt](https://npm.io/package/bcrypt.md) ^3.0.4
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [yeoman-generator](https://npm.io/package/yeoman-generator.md) ^3.1.1

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2019-03-17
- 1.0.4 — 2019-02-07
- 1.0.3 — 2019-01-20
- 1.0.2 — 2019-01-20
- 1.0.1 — 2019-01-06
- 1.0.0 — 2019-01-03

## README

# 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](https://github.com/UnDer-7/generator-lazy-backend-entity) available as well
## Video exemple
![Fail to load the video](https://media.giphy.com/media/62789RPCUl8xGsoWMA/giphy.gif)
## 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](https://github.com/UnDer-7/generator-lazy-backend-entity) available for you.

You can install the package from npm
```
npm i -g generator-lazy-backend-entity
```
You can access it's [GitHub](https://github.com/UnDer-7/generator-lazy-backend-entity) 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](https://github.com/UnDer-7/template-project)
  ## Project Dependencies
  1. bcrypt
     - Responsible for encrypting the user's password
     - Only added if you add JWT validations
     - [npm](https://www.npmjs.com/package/bcrypt)
  2. jsonwebtoken
     - Makes possible to create a JWT Token
     - Only added if you add JWT validations
     - [npm](https://www.npmjs.com/package/jsonwebtoken)
  3. dotenv
     - Permit the posibilite to use environment variables
     - [npm](https://www.npmjs.com/package/dotenv)
  4. express
     - Handles HTTP requests
     - [npm](https://www.npmjs.com/package/express)
  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](https://www.npmjs.com/package/express-async-handler)
  6. express-validation
     - Use the joi validations, if the validation fails a response with error is returned
     - [npm](https://www.npmjs.com/package/express-validation)
  7. joi
     - Responsible to validate the fields
     - [npm](https://www.npmjs.com/package/joi)
  8. mongoose
     - MongoDB ODM for NodeJS
     - [npm](https://www.npmjs.com/package/mongoose)
  9. mongoose-paginate
     - Do the pagination
     - [npm](https://www.npmjs.com/package/mongoose-paginate)
 10. require-dir
     - Reduce the amount of require() you will make
     - [npm](https://www.npmjs.com/package/require-dir)
 11. youch
     - Makes NodeJS' error more readable
     - [npm](https://www.npmjs.com/package/youch)
### Dev-Dependencies 
  1. eslint
     - Lint the code
     - Use the standard configuration
     - [npm](https://www.npmjs.com/package/eslint)
  2. nodemon
     - Restarts the application when a file change occurs
     - [npm](https://www.npmjs.com/package/nodemon)
  ## Author
Mateus Gomems da Silva Cardoso | mateus7532@gmail.com

---
_Source: https://npm.io/package/generator-lazy-backend · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
