-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
41 lines (31 loc) · 976 Bytes
/
server.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
/* global process */
/* global require */
/* global console */
/* global module */
/* global __dirname */
///////////////----------------------------- SERVER
'use strict';
require('dotenv').config();
var express = require('express'),
app = express(),
server = require('http').Server(app),
io = require('socket.io')(server),
cookieParser = require('cookie-parser');
app.use(cookieParser());
//-- SERVE STATIC FILES
app.use(express.static('public'));
//--RETHINK SETUP
require('./setupRethink.js');
//--SOCKETS
exports.io = require('./sockets/events.js')(io);
//--API
var bodyParser = require('body-parser'),
compression = require('compression');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(compression());
require('./api/routes.js')(app);
//--START SERVER
server.listen(process.env.WEB_PORT, function () {
// console.info('Command + Double Click http://www.website.com:' + process.env.WEB_PORT);
});
exports.server = server;