app.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 48
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 10
Bugs 0 Features 0
Metric Value
cc 0
wmc 2
c 10
b 0
f 0
nc 4
mnd 0
bc 2
fnc 2
dl 0
loc 48
ccs 29
cts 29
cp 1
crap 0
rs 10
bpm 1
cpm 1
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A app.use 0 7 1
A ➔ ??? 0 4 1
1
"use strict";
2
3 1
const express = require('express');
4 1
const routes = require('./routes');
5 1
const http = require('http');
6 1
const errorHandler = require('errorhandler');
7 1
const logger = require('morgan');
8
9 1
const app = express();
10 1
const server = http.createServer(app);
11
12 2
const dsn =  process.env.DBWEBB_DSN || "mongodb://localhost:27017/mumin";
13
14 1
const socket = require('./src/socket');
15
16 1
socket.socket(server);
17
18
// all environments
19 2
app.set('port', process.env.DBWEBB_PORT || 3000);
20 1
app.use(logger('dev'));
21
22
// development only
23 2
'development' == app.get('env') && app.use(errorHandler());
24
25 1
app.locals.something = 'value';
26 1
app.locals.qaz = 'qut';
27
28 1
app.get('/', routes.index);
29 1
app.get('/posts/:id', routes.posts);
30 1
app.get("/users/:id", routes.users);
31 1
app.get('/db/getAll', routes.dbGetAll);
32 1
app.get('/db/insert/:ob', routes.dbInsert);
33
34
35 1
app.use(function(req, res, next) {
36 1
    let err = new Error('Not Found');
37
38 1
    err.status = 404;
39 1
    next(err);
40 1
    res.json({'error': 'error'});
41
});
42
43 1
server.listen(app.get('port'), () => {
44 1
    console.info('Express server listening on port ' + app.get('port'));
45 1
    console.info('DNS is ' + dsn);
46
});
47
48
module.exports = app;
49