config/routes.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 36
Function Count 5

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 36
rs 10
wmc 5
mnd 0
bc 5
fnc 5
bpm 1
cpm 1
noi 2

1 Function

Rating   Name   Duplication   Size   Complexity  
B module.exports 0 29 1
1
const cont = require('../controllers')
2
const CustomerController = cont.Customer
3
const PriceController = cont.Price
4
const MessageController = cont.Message
5
const AuthController = cont.Auth
6
const passportConfig = require('./passport')
0 ignored issues
show
Unused Code introduced by
The constant passportConfig seems to be never used. Consider removing it.
Loading history...
7
8
module.exports = function (app) {
9
  // API
10
  app.use('/api/customers', new CustomerController().routeAPI())
11
  app.use('/customers', new CustomerController().route())
12
  app.use('/api/prices', new PriceController().routeAPI())
13
  app.use('/api/messages', new MessageController().routeAPI())
14
15
  app.use('/auth', new AuthController().route())
16
17
  // Ordinary web pages
18
  app.get('/', 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...
19
    res.render('home/home', { title: 'Grogan Burner Services' })
20
  })
21
22
  // Testing Flash messages
23
  app.get('/flash', function (req, res) {
24
    req.flash('info', 'Hi there!')
25
    res.redirect('/')
26
  })
27
28
  app.get('/no-flash', function (req, res) {
29
    res.redirect('/')
30
  })
31
32
  app.get('/multiple-flash', function (req, res) {
33
    req.flash('info', ['Welcome', 'Please Enjoy'])
34
    res.redirect('/')
35
  })
36
}
37