Code Generation
#
Create a projectCreate a new directory with all the required files to get started.
If you specify the flag --mongodb
, the new project will use mongoose
and @foal/mongoose
in place of typeorm
and @foal/typeorm
. You can find more information here.
If you specify the flag --yaml
, the new project will use YAML format for its configuration files. You can find more information here.
#
Create a controllerCreate a new controller in ./src/app/controllers
, in ./controllers
or in the current directory depending on which folders are found.
Example
Output
--register
flag#
The If you wish to automatically create a new route attached to this controller, you can use the --register
flag to do so.
Example
Output
app.controller.ts
api.controller.ts
#
Create an entity (simple model)Create a new entity in ./src/app/entities
, in ./entities
or in the current directory depending on which folders are found.
#
Create a model (only for Mongoose)Create a new model in ./src/app/models
, in ./models
or in the current directory depending on which folders are found.
#
Create REST APICreate a new controller and a new entity to build a basic REST API. Depending on which directories are found, they will be generated in src/app/{entities}|{controllers}/
, {entities}|{controllers}/
or in the current directory.
If you are in the root directory and you want to automatically register the controller within the app controller you can add the --register
flag.
See the page REST Blueprints for more details.
#
Create a hookCreate a new hook in ./src/app/hooks
, in ./hooks
or in the current directory depending on which folders are found.
#
Create a scriptCreate a new shell script in src/scripts
regardless of where you run the command.
#
Create a sub-appCreate a new sub-app with all its files in ./src/app/sub-apps
, in ./sub-apps
or in the current directory depending on which folders are found.
#
Create a serviceCreate a new service in ./src/app/services
, in ./services
or in the current directory depending on which folders are found.
Example
Output