1.0.9 • Published 2 years ago

express-cr v1.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Express-cr

CLI tool to Generate Boilerplate Code for creating REST API Routes and Controllers

It is tiresome to write same lines of Code

router.get("/endpoint", Controller.Method);
router.get("/endpoint/:id", Controller.Method);
router.post("/endpoint", Controller.Method);
router.put("/endpoint/:id", Controller.Method);
router.patch("/endpoint/:id", Controller.Method);
router.delete("/endpoint/:id", Controller.Method);

Specially if the application is very Large, and there are alot of routes to create, this gives unnecessary headache while development. This only is route creation. Creating controllers for these routes is even more tiresome.

Express-cr package removes this headache by allowing you to generate these files on the fly with a simple command.

Requirements

The Application Runs on Node JS v10x and above. The tool is made for Express Framework.

Compilation Requirements

  • Node JS v10.x and above
  • Express

Installation

Installation Globally

$ npm install --global express-cr

Installation In as Dev Dependency

$ npm install --save-dev express-cr

File Generation

The file structure adopted by express-cr is as below:

root
├── controllers         # Auto Generated when command is run First Time.
                          All Files for controllers reside inside this directory.
├── routes              # Auto Generated when command is run First Time.
                          All Files for routing reside in inside this directory
├── server.js
├── package.json
├── package-lock.json
├── .gitignore
└── README.md

Creating Controller and Routes Combined (No CRUD Functions)

$ express-cr cr:create
  ? Name of Controller: Name

Creating Controller and Routes Combined (With CRUD Functions)

$ express-cr cr:create -c
  ? Name of Controller: Name

Creating Controller Only (Without CRUD)

$ express-cr c:create
  ? Name of Controller: Name

Creating Controller Only (With CRUD)

$ express-cr c:create -c
  ? Name of Controller: Name

Creating Route Only (Without CRUD)

$ express-cr r:create
  ? Name of Route: Name

Creating Route Only (With CRUD)

$ express-cr r:create -c
  ? Name of Route: Name

GitHub

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago