我正在使用Nestjs (7.x) 和Fastify (with @nestjs/platform-fastify
)。我正在尝试在我的项目( )中安装Helmetfastify-helmet
,但我无法弄清楚如何将它与 Nestjs 集成/配置。让它登机的正确方法是什么?
这是我的 Nestjs 引导程序:
import { NestFactory } from '@nestjs/core';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
import { MainModule } from './main.module';
import * as helmet from 'fastify-helmet';
async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(MainModule);
await app.listen(3000, 0.0.0.0);
}
bootstrap();