1.0.9 • Published 1 year ago

nestboard v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

NestBoard

Logo

NestBoard is a package that allows you to easily create CRUD APIs through a dashboard in nestjs. With this package, you can quickly generate code for creating, reading, updating, and deleting records in your database. In addition to CRUD APIs, the package also provides dashboard features for managing and organizing all of your APIs.

NestBoard is built on top of Swagger documentation, which means that it uses the Swagger API specification to generate and manage your API code. This allows you to easily modify and customize your APIs through a web-based dashboard without needing to manually edit any code.

Demo

https://youtu.be/HWpMA_q_eb8

Getting Started

To get started with using the NestBoard package, follow these steps:

  1. Install the package using npm or yarn:
npm install --save nestboard

or

yarn add nestboard
  1. import SwaggerModule and DashBoardModule :
import { NestFactory } from '@nestjs/core';
import { SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';
import { DashBoardModule } from 'nestboard';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  const document = SwaggerModule.createDocument(app, SwaggerConfig);
 
  DashBoardModule.setup(app, document);

  await app.listen(3000);
}
bootstrap();

Need to setup DashBoardModule

  DashBoardModule.setup(app, document);
  1. Run project in watch mode (--watch) :
yarn start:dev

or

npm run start:dev

you can access the NestBoard dashboard at

http://localhost:3000/nestboard/.

Sequelize Configuration

import { SequelizeModule } from '@nestjs/sequelize';
import { ConfigModule, ConfigService } from '@nestjs/config';

@Module({
  imports: [
    SequelizeModule.forRootAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        dialect: 'mysql',
        host: configService.get('DB_HOST'),
        port: configService.get('DB_PORT'),
        username: configService.get('DB_USERNAME'),
        password: configService.get('DB_PASSWORD'),
        database: configService.get('DB_NAME'),
        autoLoadModels: true, 
        synchronize: true,
      }),
      inject: [ConfigService],
    }),
  ],
})
export class AppModule {}

Important

autoLoadModels: true, 
synchronize: true,

Modifying Existing API

Include @ApiTags() Decorator

add @ApiTags('collection') in findAll()

  @Get()
  @ApiTags('collection')
  findAll() {
    // your code here
  }

add @ApiTags('create-collection') in findAll()

  @Get()
  @ApiTags('create-collection')
  create() {
    // your code here
  }
1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago