expressjs-cli

1.0.15 • Public • Published

Commitizen friendly PIPELINE

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

Readme

Keywords

Package Sidebar

Install

npm i expressjs-cli

Weekly Downloads

0

Version

1.0.15

License

ISC

Unpacked Size

7.19 MB

Total Files

47

Last publish

Collaborators

  • vitordelfino