-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
47 lines (40 loc) · 1.17 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
// 주요 library 초기화
const express = require('express');
const session = require('express-session');
const sessionFileStore = require('session-file-store')(session);
const requestId = require('express-request-id');
const passport = require('passport');
const bodyParser = require('body-parser');
const i18n = require('i18n');
const path = require('path');
// 전역변수
global.__appRoot = path.resolve(__dirname);
i18n.configure({
locales: ['en', 'ja', 'ko'],
directory: __dirname + '/locales',
register: global
});
var app = express();
app.use(session({
store: new sessionFileStore({
path: './cache/sessions'
}),
secret: 'statsbot',
resave: false,
saveUninitialized: false,
maxAge: null
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(i18n.init);
var logger = require('./module/logger');
var ga = require('./module/ga');
var auth = require('./route/auth');
var webhook = require('./route/webhook');
ga.runServer();
app.use('/auth', auth);
app.use('/webhook', bodyParser.json(), webhook);
app.use('/public', express.static('./public'));
app.listen(process.env.PORT, function() {
logger.info('Listening on port ', process.env.PORT);
});