Completed
Push — master ( 67e4d1...18ce39 )
by
unknown
02:06
created

src/server/routes/get-update.js   A

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 30
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
A get-update.js ➔ route 0 23 1
1
import {
2
  abeDuplicate,
3
  Hooks
4
} from '../../cli'
5
6
var route = function(req, res, next) {
7
  Hooks.instance.trigger('beforeRoute', req, res, next)
8
9
  var p = abeDuplicate(req.query.oldFilePath, req.query.selectTemplate, req.query.filePath, req.query.tplName, req, true)
10
11
  p.then((resSave) => {
12
    var result = {
13
      success: 1,
14
      json: resSave
15
    }
16
    res.set('Content-Type', 'application/json')
17
    res.send(JSON.stringify(result))
18
  },
19
  () => {
20
    var result = {
21
      success: 0
22
    }
23
    res.set('Content-Type', 'application/json')
24
    res.send(JSON.stringify(result))
25
  }).catch(function(e) {
26
    console.error(e)
27
  })
28
}
29
30
export default route