egg-nest
v1.0.4
Published
This npm package allows you to quickly generate a new NestJS API with pre-configured modules and Swagger documentation.
Downloads
18
Maintainers
Readme
Egg NestJS API Boilerplate
This npm package allows you to quickly generate a new NestJS API with pre-configured modules and Swagger documentation.
Features
- Automatic Swagger documentation generation
- User login system pre-configured
- Customizable API modules and entity fields
- Integration with Typeorm and MySQL
Installation
To install the package, simply run:
npm install -g egg-nest
This will install the package globally, so you can use it from anywhere on your system.
Creating the JSON construction file
To create the JSON construction file go to the api directory that you want and run:
egg-nest init
This will create a JSON file in your current directory with the basic structure for your API. You can then edit this file to add or remove modules, update entity fields, and customize your API as needed.
Example JSON file
{
api_name: "example-api",
modules: [
{
name: "Person",
entity: ["name", "age", "height"],
},
{
name: "Pet",
entity: ["name", "age", "weight"],
},
],
}
In this example, we have an API with two modules: "Person" and "Pet". The "Person" module has three entity fields: "name", "age", and "height", while the "Pet" module has three entity fields: "name", "age", and "weight".
Generating the API from the JSON file
Once you've finished updating your JSON construction file, save it and run:
egg-nest generate
This will automatically generate your API boilerplate with pre-configured modules and Swagger documentation with the changes you made to the JSON file.
Contributing
If you find any issues or have any suggestions for improving this package, feel free to submit a pull request or open an issue on the GitLab repository. We welcome any and all contributions!