gwm
This commit is contained in:
parent
0ecbb1b756
commit
f466c23d57
20
server.js
20
server.js
@ -1,6 +1,10 @@
|
|||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
const app = express()
|
const app = express();
|
||||||
|
|
||||||
|
//logger
|
||||||
|
const {logMsg} = require('./app/services/logger.js');
|
||||||
|
|
||||||
//it is used to clear cache
|
//it is used to clear cache
|
||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
|
res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
|
||||||
@ -8,13 +12,16 @@ app.use(function(req, res, next) {
|
|||||||
res.set("Expires", 0)
|
res.set("Expires", 0)
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
const {logMsg} = require('./app/services/logger.js');
|
|
||||||
|
|
||||||
|
//body-parser
|
||||||
|
const bodyParser = require('body-parser')
|
||||||
|
app.use(bodyParser.json({ limit: '50mb' }));
|
||||||
|
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
|
||||||
|
|
||||||
|
|
||||||
|
//swagger
|
||||||
const swaggerJsdoc = require('swagger-jsdoc');
|
const swaggerJsdoc = require('swagger-jsdoc');
|
||||||
const swaggerUi = require('swagger-ui-express');
|
const swaggerUi = require('swagger-ui-express');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
definition: {
|
definition: {
|
||||||
openapi: '3.0.0',
|
openapi: '3.0.0',
|
||||||
@ -25,11 +32,8 @@ const options = {
|
|||||||
},
|
},
|
||||||
apis: ['./app/routes/routes.js'], // files containing annotations as above
|
apis: ['./app/routes/routes.js'], // files containing annotations as above
|
||||||
};
|
};
|
||||||
|
|
||||||
const swaggerDocument = swaggerJsdoc(options);
|
const swaggerDocument = swaggerJsdoc(options);
|
||||||
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /:
|
* /:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user