0.2.0 • Published 6 years ago

nestg v0.2.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

nest-generator v0.2.0

The nest-generator generated modules for you NestJS Application Based on https://github.com/bipin000/nestjs-generator and https://github.com/zMotivat0r/nest-crud/

Installation

Using nest-generator:

$ npm install nestg -g

Usage:

$ nestg module myModuleName <options>

...generated controller...
...generated entity...
...generated service...
...generated module...

Options:

-c: create crud api with @nestjsx/crud (need install it before: npm i @nestjsx/crud --save)

API Methods and Endpoints

Assume you've created some CRUD controller with the route @Controller('cats'). In that case, Nest will create endpoints as follows:

GET /cats

Res Data: array of entities; an empty array Res Code: 200

GET /cats/:id

Req Params: :id - entity id Res Data: entity object Res Code: 200; 400; 404

POST /cats

Req Body: entity object Res Data: entity object Res Code: 201; 400

PUT /cats/:id

Req Params: :id - entity id Req Body: entity object Res Data: entity object Res Code: 201; 400; 404

DELETE /cats/:id

Req Params: :id - entity id Res Data: empty Res Code: 200; 400; 404