-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
41 lines (37 loc) · 1.26 KB
/
index.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
const express = require('express');
global.app = express();
const http = require('http').Server(global.app);
global.io = require('socket.io')(http);
global.fs = require("fs");
global.path = require('path');
global.multer = require('multer');
global.bodyParser = require('body-parser');
global.session = require('express-session');
global.Cookies = require('cookies');
global.mongo = require('mongodb');
global.mongoose = require('mongoose');
global.moment = require('moment');
require('dotenv').config();
global.app.use( global.bodyParser.json({limit: '50mb'}) ); // to support JSON-encoded bodies
global.app.use(global.bodyParser.urlencoded({ extended: false,
parameterLimit: 1000000,
limit: '50mb'}));;
global.app.use(global.session({
secret: '2C44-4D44-WppQ38S',
resave: true,
saveUninitialized: true,
cookie: {
path: '/',
httpOnly: true,
secure: false,
maxAge: 8640000
},
rolling: true
}));
global.app.use(express.static(__dirname + '/public'));
global.systems = require('./systems');
global.app.set('port', (process.env.PORT || 3000));
http.listen(global.app.get('port'), function(){
console.log("1) Api App Server starts");
console.log("2) It is running with port " + global.app.get('port'));
});