1.0.15 • Published 5 years ago

expressjs-cli v1.0.15

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

Commitizen friendly PIPELINE npm.io npm.io npm.io npm.io npm.io

ExpressJs CLI (Project in progress)

A CLI to create a nodejs project pre configured

Techs

  • Express
  • Typescript
  • Jest
  • ESLint
  • Babel
  • Commitizen
  • Husky

How to use

Install package globally

yarn add --global expressjs-cli
or
npm i -g expressjs-cli

Run command to create a project

expressjs-cli start <project name>

Configuring after generate project

You can rename all folders, files, contents that obtain "Replace" text;

  • src/apps/Replace (all files)
  • src/config/db/standart.connection.ts

Update env files with DATABASE_URL, example below.

.env | .env.development | .env.test

  DATABASE_URL=mongodb+srv://<username>:<password>@<host>/<database>?retryWrites=true&w=majority

Generate new CRUD

Run command in root path (near package.json)

expressjs-cli crud <Model | Entity>

Terminal log

Command will generate a new module in src/apps folder with:

  • Route
  • Validator
  • Controller
  • Service
  • Crud tests

After run command updates some files;

  • src/routes.ts: import new routes from module and configure the path
  • src/config/db/standart.connection.ts: add new Entity on Typeorm connection

Informations

Some infos about created project.

Structure

Project Structure

How to throw Errors

Throws error

How to use logger

Logger

Use Yup or class-validator to validate models

  • Always import "express-async-errors" when use middlewares in your routes

route.ts

Hello.ts

HelloValidator.ts


Run tests

yarn test
or
npm run test
1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago