我想在巢上集成nuxt swagger fastify。
const server: AbstractHttpAdapter = new FastifyAdapter();
const app = await NestFactory.create<NestFastifyApplication>(AppModule);
//#region Init Nuxt.js
// Import and Set Nuxt.js options
const nuxtConfig = require('../nuxt.config.js');
nuxtConfig.dev = !(process.env.NODE_ENV === 'production');
const nuxt = await new Nuxt(nuxtConfig);
// // Build only in dev mode
nuxtConfig.dev = !(process.env.NODE_ENV === 'production');
if (nuxtConfig.dev) {
// const builder = new Builder(nuxt);
// await builder.build();
new Builder(nuxt).build();
}
//#endreion
app.useGlobalPipes(new ValidationPipe({ transform: true }));
const basePath = config.get('api.basePath');
// app.useGlobalInterceptors(new LoggingInterceptor());
// app.useGlobalGuards(new RolesGuard());
app.setGlobalPrefix(basePath);
const packageBody = require('../package.json');
const options = new DocumentBuilder()
.setTitle(packageBody.name)
.setDescription(packageBody.description)
.setVersion(packageBody.version)
.setSchemes('http', 'https')
.addBearerAuth('Authorization', 'header')
.setBasePath('api')
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('docs', app, document);
await app.init();
console.log('Swagger dependencies initialized');
const { httpPort, host } = config.get('app');
await app.listen(3000, '0.0.0.0');
app.use(nuxt.render);
预期结果是...
http://127.0.0.1/api-数据接口 http://127.0.0.1/docs-显示大摇大摆的用户界面 http://127.0.0.1/ ...-nuxt渲染页面
但是 无法显示nuxt页面。