Add swagger integration

This commit is contained in:
2023-09-12 09:27:08 -06:00
parent 4fb5a6d2bf
commit a19affcdfd
6 changed files with 42 additions and 9 deletions

View File

@@ -1,8 +1,10 @@
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { IswordService } from './isword.service';
import { ApiTags } from '@nestjs/swagger';
export type AreWordsDto = string[]
@ApiTags('dictionary')
@Controller('isword')
export class IswordController {
constructor(

View File

@@ -7,7 +7,6 @@ export class IswordService {
private readonly dictContents: string[];
constructor() {
this.dictContents = readFileSync(this.dict).toString().split('\n')
}
isWord = (word: string) =>

View File

@@ -1,8 +1,16 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const config = new DocumentBuilder()
.setTitle('us.dev API')
.setDescription("Chip's generalized API")
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api', app, document);
app.enableCors({origin: "*"});
await app.listen(3000);
}

View File

@@ -1,6 +1,8 @@
import { Controller, Get, Param } from '@nestjs/common';
import { ParkioService } from './parkio.service';
import { ApiTags } from '@nestjs/swagger';
@ApiTags('parkio')
@Controller('parkio')
export class ParkioController {
constructor(