6.3.3 • Published 8 months ago

@bull-board/nestjs v6.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@bull-board/nestjs

NestJS for bull-board.

Overview UI

Installation

Install both @bull-board/api and this module.

$ npm install --save @bull-board/nestjs @bull-board/api

Install the Express or Fastify adapter depending on what you use in NestJS (default is Express)

$ npm install --save @bull-board/express
//or 
$ npm install --save @bull-board/fastify

Register the root module

Once the installation is completed, we can import the BullBoardModule into your rootmodule e.g. AppModule.

import { Module } from '@nestjs/common';
import { BullBoardModule } from "@bull-board/nestjs";
import { ExpressAdapter } from "@bull-board/express";

@Module({
  imports: [
    BullModule.forRoot({
      // your bull module config here.
    }),

    BullBoardModule.forRoot({
      route: '/queues',
      adapter: ExpressAdapter // Or FastifyAdapter from `@bull-board/fastify`
    }),
  ],
})
export class AppModule {
}

The forRoot() method registers the bull-board instance and allows you to pass several options to both the instance and module. The following options are available.

  • route the base route for the bull-board instance adapter.
  • adapter The routing adapter to be used, either the Express Adapter or Fastify Adapter provided by bull-board.
  • boardOptions options as provided by the bull-board package, such as uiBasePath and uiConfig
  • middleware optional middleware for the express adapter (e.g. basic authentication)

Register your queues

To register a new queue, you need to register BullBoardModule.forFeature in the same module as where your queues are registered.

import { Module } from '@nestjs/common';
import { BullBoardModule } from "@bull-board/nestjs";
import { BullMQAdapter } from "@bull-board/api/bullMQAdapter";
import { BullModule } from "@nestjs/bullmq";

@Module({
  imports: [
    BullModule.registerQueue(
      {
        name: 'my_awesome_queue'
      }
    ),
    
    BullBoardModule.forFeature({
      name: 'my_awesome_queue',
      adapter: BullMQAdapter, //or use BullAdapter if you're using bull instead of bullMQ
    }),
  ],
})
export class FeatureModule {}

The forFeature method registers the given queues to the bull-board instance. The following options are available.

  • name the queue name to register
  • adapter either BullAdapter or BullMQAdapter depending on which package you use.
  • options queue adapter options as found in the bull-board package, such as readOnlyMode, description etc.

Using the bull-board instance in your controllers and/or services.

The created bull-board instance is available via the @InjectBullBoard() decorator. For example in a controller:

import { Controller, Get } from "@nestjs/common";
import { BullBoardInstance, InjectBullBoard } from "@bull-board/nestjs";

@Controller('my-feature')
export class FeatureController {

  constructor(
    @InjectBullBoard() private readonly boardInstance: BullBoardInstance
  ) {
  }
  
  //controller methods
}

Usage examples

  1. Simple NestJS setup

For more info visit the main README

6.3.3

8 months ago

6.3.2

8 months ago

6.3.1

8 months ago

6.3.0

8 months ago

6.2.4

8 months ago

6.2.3

8 months ago

6.2.2

8 months ago

6.1.0

8 months ago

6.0.1

8 months ago

6.0.0

9 months ago

6.2.1

8 months ago

6.2.0

8 months ago

6.0.2

8 months ago

5.21.7

9 months ago

5.21.6

9 months ago

5.21.5

9 months ago

5.23.0

9 months ago

5.22.0

9 months ago

5.18.3

1 year ago

5.18.2

1 year ago

5.18.1

1 year ago

5.18.0

1 year ago

5.21.4

10 months ago

5.21.3

11 months ago

5.21.2

11 months ago

5.21.1

11 months ago

5.21.0

12 months ago

5.19.2

1 year ago

5.19.1

1 year ago

5.19.0

1 year ago

5.20.5

12 months ago

5.20.4

12 months ago

5.20.3

12 months ago

5.20.2

1 year ago

5.20.1

1 year ago

5.20.0

1 year ago

5.17.1

1 year ago

5.17.0

1 year ago

5.16.0

1 year ago

5.15.5

1 year ago

5.15.4

1 year ago

5.15.3

1 year ago

5.15.2

1 year ago

5.15.0

1 year ago

5.15.1

1 year ago

5.14.2

1 year ago

5.14.1

1 year ago

5.14.0

1 year ago

5.13.0

1 year ago

5.12.0

1 year ago

5.11.0

1 year ago

5.10.3

1 year ago

5.10.2

2 years ago

5.10.1

2 years ago

5.10.0

2 years ago

5.9.2

2 years ago

5.8.4

2 years ago

5.8.3

2 years ago

5.9.1

2 years ago

5.8.2

2 years ago

5.9.0

2 years ago

5.8.1

2 years ago

5.7.2

2 years ago

5.8.0

2 years ago

5.7.1

2 years ago

5.7.0

2 years ago

5.6.1

2 years ago

5.6.0

2 years ago

5.5.3

2 years ago

5.5.2

2 years ago

5.5.1

2 years ago

5.5.0

2 years ago

5.4.0

2 years ago

5.3.1

2 years ago