-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
30 lines (25 loc) · 886 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
require('dotenv').config()
require('./mongodb/db');
var express = require('express');
var path = require('path');
var session = require('express-session');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var history = require('connect-history-api-fallback');
var apiRouter = require('./routes/api');
var app = express();
app.use(logger('dev'));
app.use(express.json({ limit: process.env.JSON_LIMT || '1mb' }));
app.use(express.urlencoded({ extended: false, limit: process.env.URLENCODED_LIMT || '1mb' }));
app.use(cookieParser());
app.use(session({
secret: process.env.ACGN_SESSION_SECRET || 'acgnlist',
name: 'acgnlist',
cookie: { maxAge: 60000 },
resave: false,
saveUninitialized: true,
}));
app.use('/api', apiRouter);
app.use(history());
app.use('/', express.static(path.join(__dirname, 'client/build')));
module.exports = app;