forked from deic-dk-retired/ddosapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtcp.js
More file actions
34 lines (32 loc) · 686 Bytes
/
tcp.js
File metadata and controls
34 lines (32 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// connect to db and then get the
// query handler method
var db = require('./db')
function getTcps (req, res, next) {
var allTcp = db.miniQuery('.sql/misc/allTcps.sql')
db.foddb.any(allTcp)
.then(function (data) {
// show jsonapi
res.status(200)
.json({
data: data.map(function (e) {
return {
type: 'tcps',
id: e.id,
attributes: {
flag: e.flag,
desc: e.desc
}
}
}),
meta: {
total: data.length
}
})
})
.catch(function (err) {
return next(err.message)
})
}
module.exports = {
getTcps: getTcps
}