-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswaggerAutogen.js
41 lines (34 loc) · 921 Bytes
/
swaggerAutogen.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
"use strict"
const HOST = "https://product-api-kappa.vercel.app"
const swaggerAutogen = require('swagger-autogen')()
const packageJson = require('./package.json')
const document = {
info: {
version: packageJson.version,
title: packageJson.title,
description: packageJson.description,
termsOfService: "https://furkandogu.vercel.app",
contact: { name: packageJson.author, email: "furkandogu2018@gmail.com" },
license: { name: packageJson.license, },
},
host: `${HOST}`,
basePath: '/',
schemes: ['https'],
definitions: {
"/login": {
email: {
type: "String",
required: true
},
password: {
type: "String",
required: true
},
},
"Product": require('./src/models/productModel').schema.obj,
"Category": require('./src/models/categoryModel').schema.obj,
}
};
const routes = ['./index.js']
const outputFile = './swagger.json'
swaggerAutogen(outputFile, routes, document)