-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
36 lines (30 loc) · 1.11 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
let express = require('express');
let cookieParser = require('cookie-parser');
let bodyParser = require('body-parser');
let indexRouter = require('./routes/index');
let pasarApi = require('./routes/pasarApi');
let stickerApi = require('./routes/stickerApi');
let jobs = require('./jobs');
let log4js = require('log4js');
log4js.configure({
appenders: {
file: { type: 'dateFile', filename: 'logs/pasar.log', pattern: ".yyyy-MM-dd.log", compress: true, },
console: { type: 'stdout'}
},
categories: { default: { appenders: ['file', 'console'], level: 'info' } },
pm2: true,
pm2InstanceVar: 'INSTANCE_ID'
});
global.logger = log4js.getLogger('default');
let app = express();
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));
app.use(log4js.connectLogger(logger, { level: log4js.levels.INFO }));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use('/feeds/api/v1', indexRouter);
app.use('/pasar/api/v1', pasarApi);
app.use('/sticker/api/v1', stickerApi);
jobs.run()
module.exports = app;