-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
40 lines (34 loc) · 1.13 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
const express = require('express');
const i18n = require('i18n');
const path = require('path');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const logger = require('morgan');
const config = require('config');
const webhookRouter = require('./app/webhook/routes');
const confirmEmailRouter = require('./app/confirm-email/routes');
const acceptRouter = require('./app/accept/routes');
const app = express();
i18n.configure({
objectNotation: true,
locales: config.supportedLanguages,
defaultLocale: 'en',
directory: __dirname + '/locales',
queryParameter: 'lang'
});
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
if(app.get('env') !== 'test') {
app.use(logger('dev'));
}
app.use(i18n.init);
app.use(bodyParser.raw({ type: 'application/json' }));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/webhook', webhookRouter);
app.use('/confirm-email', confirmEmailRouter);
app.use('/accept', acceptRouter);
module.exports = app;