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";
|
2020-05-09 16:29:17 +02:00
|
|
|
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);
|
2020-05-09 16:29:17 +02:00
|
|
|
app.useGlobalPipes(
|
|
|
|
|
new ValidationPipe({
|
|
|
|
|
transform: true,
|
|
|
|
|
transformOptions: { enableImplicitConversion: true },
|
|
|
|
|
})
|
|
|
|
|
);
|
2020-05-03 04:32:43 +02:00
|
|
|
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();
|