A code generator responsable to generate code for a NestJs application.
This application implements a specification REST API to work together with the create-backend-app-core app.
$ yarn install
# development
$ yarn start
# watch mode
$ yarn start:dev
# production mode
$ yarn start:prod
# unit tests
$ yarn test
# e2e tests
$ yarn test:e2e
# test coverage
$ yarn test:cov
Nest Rest Generator is MIT licensed.
Summary of the available routes that you can access.
GET /whoami
Returns a JSON specifying what layers of a REST API for a Modal the app can generate and which type of API this is. Example of response:
{
"apiType": "REST",
"model": true,
"module": true,
"create": true,
"update": true,
"service": true,
"controller": true,
"repository": true
}
POST /controller
It gonna return the code of a controller file as a string. This is an example of a body to send:
{
"implementedMethods": ["POST", "GET", "PUT"],
"entityName": "User",
"layerBellow": "service"
}
POST /service
It gonna return the code of a service file as a string. This is an example of a body to send:
{
"implementedMethods": ["POST", "GET", "PUT"],
"entityName": "User",
"layerBellow": null
}
POST /repository
It is going to return the code of a mocked repository. This is an example of a body to send:
{
"implementedMethods": ["POST", "GET", "PUT", "DELETE"],
"entityName": "Product",
}
POST /module
{
"entityName": "User",
"controllers": ["User"],
"services": ["User", "Product"],
"repositories": ["User"],
"modules": ["Product"]
}
POST /model
It gonna return the code of a model file as a string. This is an example of a body to send:
{
"entityName": "User",
"attributes": [
{
"name": "id",
"type": "string",
"required": false
},
{
"name": "name",
"type": "string",
"required": true
},
{
"name": "pastNames",
"type": {
"typeName": "string[]",
"importable": false
},
"required": false
},
{
"name": "email",
"type": "string",
"required": true
},
{
"name": "password",
"type": "string",
"required": true
}
]
}
It is going to return the code of a Create${entityName}Dto
. This is an example of a body to send:
{
"entityName": "User",
"attributes": [
{
"name": "name",
"type": "string",
"required": true
},
{
"name": "products",
"type": "string[]",
"required": false
},
{
"name": "email",
"type": "string",
"required": true
},
{
"name": "password",
"type": "string",
"required": true
}
]
}
It is going to return the code of a Update${entityName}Dto
. This is an example of a body to send:
{
"entityName": "User",
"attributes": [
{
"name": "name",
"type": "string",
"required": true
},
{
"name": "products",
"type": "string[]",
"required": false
}
]
}
GET /static-files
It gonna return all static files necessary to create a project