server.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 41
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 41
rs 10
wmc 1
mnd 0
bc 1
fnc 1
bpm 1
cpm 1
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A app.use 0 3 1
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
Unused Code introduced by
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);