examples/chat/app.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 37
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 27
mnd 1
bc 1
fnc 1
dl 0
loc 37
bpm 1
cpm 2
noi 1
c 0
b 0
f 0
rs 10
1
import jsonServer from 'json-server';
2
3
const port = process.env.PORT || 3001;
4
const users = [ {
5
    'id'    : 1,
6
    'name'  : 'Leigh',
7
    'email' : '[email protected]'
8
}, {
9
    'id'    : 2,
10
    'name'  : 'Ancell',
11
    'email' : '[email protected]'
12
}, {
13
    'id'    : 3,
14
    'name'  : 'Conre',
15
    'email' : '[email protected]'
16
} ];
17
18
const messages = [ {
19
    text   : 'butter property president flow nodded degree where keep',
20
    sender : 2
21
}, {
22
    text   : 'cheese tried dig interior watch tone time train living',
23
    sender : 1
24
} ];
25
26
const server = jsonServer.create();
27
const router = jsonServer.router({ users, messages });
28
29
server.use(router);
30
31
if (!process.env.TEST) {
32
    server.listen(port, () => {
33
        console.log(`Chat server is running on ${port}`);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
34
    });
35
}
36
37
export default server;
38