Listory/src/main.ts

33 lines
968 B
TypeScript
Raw Normal View History

2020-01-25 22:19:14 +01:00
import { NestFactory } from "@nestjs/core";
2020-01-26 19:07:15 +01:00
import { NestExpressApplication } from "@nestjs/platform-express";
2020-02-01 16:11:48 +01:00
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
2020-01-25 22:19:14 +01:00
import { AppModule } from "./app.module";
import { ValidationPipe } from "@nestjs/common";
2020-01-25 22:19:14 +01:00
async function bootstrap() {
2020-01-26 19:07:15 +01:00
const app = await NestFactory.create<NestExpressApplication>(AppModule);
app.useGlobalPipes(
new ValidationPipe({
transform: true,
transformOptions: { enableImplicitConversion: true },
})
);
app.enableShutdownHooks();
2020-01-26 19:07:15 +01:00
2020-02-01 16:11:48 +01:00
// Setup API Docs
const options = new DocumentBuilder()
.setTitle("Listory")
.setDescription("Track and analyze your Spotify Listens")
.setVersion("1.0")
.addBearerAuth()
.addTag("user")
.addTag("listens")
.addTag("auth")
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup("api/docs", app, document);
2020-01-26 19:07:15 +01:00
2020-01-25 22:19:14 +01:00
await app.listen(3000);
}
bootstrap();