CliffbreakTS-Viewer/server/src/server.ts
Simon 7726223698
All checks were successful
continuous-integration/drone/push Build is passing
fix(server): linting issues
2020-09-21 14:56:11 +02:00

44 lines
No EOL
1.5 KiB
TypeScript

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<void> {
const app = await NestFactory.create<NestFastifyApplication>(
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();