-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
34 lines (29 loc) · 813 Bytes
/
app.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
const path = require('path');
const cookies = require('cookie-parser');
const express = require('express');
const jwt = require('express-jwt');
const logger = require('morgan');
const jsdoc = require('swagger-jsdoc');
const swagger = require('swagger-ui-express');
const app = express();
app.use(
'/docs',
swagger.serve,
swagger.setup(jsdoc(require('./swagger.config')), { explorer: true }),
);
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookies());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', require('./routes/index'));
app.use('/', require('./routes/auth'));
app.use(
'/api',
jwt({
secret: process.env.JWT_SECRET,
algorithms: ['HS256'],
}),
require('./routes/users'),
);
module.exports = app;