Issues (34)

server.js (1 issue)

Severity
1
'use strict';
2
3
// Chat application dependencies
4
var express 	= require('express');
5
var app  		= express();
6
var path 		= require('path');
7
var bodyParser 	= require('body-parser');
8
var flash 		= require('connect-flash');
9
10
// Chat application components
11
var routes 		= require('./app/routes');
12
var session 	= require('./app/session');
13
var passport    = require('./app/auth');
14
var ioServer 	= require('./app/socket')(app);
15
var logger 		= require('./app/logger');
16
17
// Set the port number
18
var port = process.env.PORT || 3000;
19
20
// View engine setup
21
app.set('views', path.join(__dirname, 'app/views'));
22
app.set('view engine', 'ejs');
23
24
// Middlewares
25
app.use(bodyParser.json());
26
app.use(bodyParser.urlencoded({ extended: false }));
27
app.use(express.static('public'));
28
29
app.use(session);
30
app.use(passport.initialize());
31
app.use(passport.session());
32
app.use(flash());
33
34
app.use('/', routes);
35
36
// Middleware to catch 404 errors
37
app.use(function(req, res, next) {
0 ignored issues
show
The parameter next is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
38
  res.status(404).sendFile(process.cwd() + '/app/views/404.htm');
39
});
40
41
ioServer.listen(port);