import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify'; import { ApplicationModule } from './app/app.module'; import { NestFactory } from '@nestjs/core'; import { join } from 'path'; const env = process.env; async function bootstrap(): Promise { const app = await NestFactory.create( ApplicationModule, new FastifyAdapter({ logger: false }), // Set to true to activate the built in logger ); app.useStaticAssets({ root: join(__dirname, '../../webapp/assets'), prefix: '/assets/', }); app.setViewEngine({ engine: { handlebars: require('handlebars'), }, templates: join(__dirname, '../../webapp/src/views'), layout: join('layouts', 'main.hbs'), options: { partials: { 'head': join('partials', 'head.hbs'), 'footer': join('partials', 'footer.hbs'), }, }, }); const swaggerOptions = new DocumentBuilder() .setTitle('Cliffbreak TeamSpeak API') .setDescription('This is the official Cliffbreak TeamSpeak API!') .addBearerAuth() .setVersion('1.0.0') .build(); const swaggerDocument = SwaggerModule.createDocument(app, swaggerOptions); SwaggerModule.setup('/api-docs', app, swaggerDocument); await app.listen(parseInt(env.PORT), '0.0.0.0'); } bootstrap();