-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
executable file
·34 lines (28 loc) · 984 Bytes
/
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
var express = require('express');
var app = express();
var index = '/index.html';
var notFound = '/notFound.html';
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var path = require('path');
var logger = require('morgan');
var indexRouter = require('./routers/index_router');
var chatRouter = require('./routers/chat_router');
var loginRouter = require('./routers/login_router');
connections = [];
room = ['lobby'];
users = [0];
roomUsers = {lobby:[]};
app.use(logger('dev'));
app.use(bodyParser.json()); // support json encoded bodies
app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies
app.use(cookieParser());
app.use(express.static(path.join(__dirname + '/public')));
app.use('/', indexRouter);
app.use('/login', loginRouter);
app.use('/chat', chatRouter);
app.use(function(req, res){
console.log('someone just viewed 404 page');
res.sendFile(path.resolve('public/notFound.html'));
});
module.exports = app;