NestJS Fastify 牛板集成

Bog*_*nyk 7 node.js typescript nestjs bullmq bull

我正在尝试将 Bull Board 集成到 NestJS + Fastify 服务中。

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);
  }
}
Run Code Online (Sandbox Code Playgroud)

app.module.ts

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

Bull Board 依赖于具有不同请求接口的 Express 应用程序。仪表板实际上可以访问,但提供静态文件失败。 浏览器+控制台截图

我试过:

  • 应用fistify-express适配器 => 导致 NestJS 出现错误
  • basePath | proxyPath: 'admin/queues'传递给reqbullBoardMiddleware

有人可以建议如何使其发挥作用吗?

先感谢您!