NestJS: OpenAPI (Swagger)

오픈소스·2023년 1월 29일
0

NestJS Boilerplate

목록 보기
14/16
$ npm install --save @nestjs/swagger

main.ts

...
  const config = new DocumentBuilder()
    .setTitle('Kakao login on NestJS framework')
    .setDescription('The OAuth login starter API description')
    .setVersion('1.0')
    .addTag('nestjs-kakaologin')
    .build();
  const document = SwaggerModule.createDocument(app, config);
  SwaggerModule.setup('api', app, document);
...

http://localhost:3000/api

참고)

  1. http://localhost:3000/auth/kakao/login
  2. http://localhost:3000/auth/kakao/callback?code=mKjK0ecB_nvqnK0ww3m4T06GnV5KVB2wWevlWmU4n2bGflBh7eHD0cq11F6XyRVvq7PNwwo9cusAAAGF_aGzdQ

    {"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm92aWRlciI6Imtha2FvIiwiaWQiOjI2MTQ3OTQyNTQsInVzZXJuYW1lIjoi7JiB6riwIiwiaWF0IjoxNjc0OTk3NTExLCJleHAiOjE2NzQ5OTc1NzF9.9oUiBRsSXNtF977XHUgfSy4I9tYlznGQfYaZN4fNBZg"}

  3. Postman

    60초 후,

0개의 댓글