-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
34 lines (33 loc) · 932 Bytes
/
Copy pathapp.js
File metadata and controls
34 lines (33 loc) · 932 Bytes
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
const express = require('express')
const app = express()
const cookieParser = require('cookie-parser')
const bodyParser = require('body-parser')
const ErrorHandling = require('./helper/error_handling')
const cors = require('cors')
const swaggerUi = require('swagger-ui-express');
const YAML = require('yamljs')
const swaggerDocument = YAML.load('./swagger.yaml')
const options = {
swaggerOptions: {
// plugins: [
// DisableTryItOutPlugin
// ],
supportedSubmitMethods: ['get', 'put', 'post', 'delete']
}
}
app.use(
bodyParser.urlencoded({
extended: false
})
)
app.use(bodyParser.json())
app.use(cors())
app.use(express.json())
app.use(express.urlencoded({ extended: false }))
app.use(cookieParser())
// documents
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, options))
// add api route here
app.use('/', require('./route/index'))
app.use(ErrorHandling)
module.exports = app