Skip to content

YueqingSheng/nestjs_a_json_to_all

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nestjs_a_json_to_all

Pass a json and get all crud apis and swagger documents. Developed based on @nestjx/crud

Prerequisite

python > 3.7

intsall ipython

install @nest/cli

install @nestjx/crud

install @nestjs/swagger

put beg.py into your nestjs project folder

Run

ipython beg.py entity_name.json

Json

your_entity.json contains the structure of your entity, it looks exactly same as the json you sent to server or responsed.

For example:

test.json

    {"name": "hi", "age": 1}

This json will convert to an entity file like this:

test.entity.ts

export class Test {
        @PrimaryGeneratedColumn()
        @ApiModelProperty()
        id: number;

        @Column()
        @ApiModelProperty()
        name: string;

        @Column()
        @ApiModelProperty()
        age: number;
}

And automatically generate corresponding module, service, controller, Swagger documents and update app.module.

Swagger

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published