7

I'm trying to integrate Bull Board in to NestJS + Fastify service.

bull-board.middleware.ts

import { Injectable, NestMiddleware } from '@nestjs/common';
import { router as bullBoardMiddleware } from 'bull-board';

@Injectable()
export class BullBoardMiddleware implements NestMiddleware {
  use(req: any, res: any, next: () => void) {
    bullBoardMiddleware(req, res, next);
  }
}

app.module.ts

import { BullBoardMiddleware } from './middlewares/bull-board.middleware';
[...]
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer
      .apply(BullBoardMiddleware)
      .forRoutes('admin/queues');
  }
}

Bull Board relies on Express application which has different Request interface. Dashboard is actually reachable but serving static files fails. Browser+Console screenshot

I tried:

  • applying fistify-express adapter => causes errors with NestJS
  • providing basePath | proxyPath: 'admin/queues' in req passed to bullBoardMiddleware

Can some one please advice how to make it working.

Thank you in advance!

0 Answers0