-
Notifications
You must be signed in to change notification settings - Fork 1
/
swagger.js
46 lines (41 loc) · 1.17 KB
/
swagger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import swaggerAutogen from 'swagger-autogen';
const options = {
openapi: '3.0.0',
}
const doc = {
info: {
title: 'Example Lucia',
description: 'Example Lucia API document'
},
host: 'localhost:8000',
tags: [
{
name: 'auth',
description: '회원가입, 로그인 등 인증에 관한 것입니다'
},
],
components: {
schemas: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer'
}
},
signupSchema: {
$email: 'example@example.com',
$password: 'password',
$retypePw: 'password',
},
loginSchema: {
$email: 'example@example.com',
$password: 'password',
},
}
}
};
const outputFile = './swagger-output.json';
const routes = ['./dist/app.js'];
/* NOTE: If you are using the express Router, you must pass in the 'routes' only the
root file where the route starts, such as index.js, app.js, routes.js, etc ... */
swaggerAutogen(options)(outputFile, routes, doc);