-
Notifications
You must be signed in to change notification settings - Fork 1
/
data.js
40 lines (30 loc) · 1.03 KB
/
data.js
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
35
36
37
38
39
40
/*
*
* data.js
* By: Simon Goring
*
*/
var express = require('express')
var router = express.Router()
var handlers = require('../handlers/data_handlers')
router.get('/', (req, res) => {
res.redirect('/api')
})
router.get('/healthwatch', function (req, res, next) {
res.status(200).json(
{ 'response': 'Okay' }
)
})
// Runs, but pulls only from URL query parameters. (Check if this is being used)
router.get('/api/update', handlers.handleGetUpdate)
router.get('/api/logs/:lines', handlers.handleLogs)
router.get('/api/logs', handlers.handleLogs)
// Populates the dojo API. Returns all API endpoints/Postgres functions.
router.get('/api', handlers.allfunctions)
router.post('/api', handlers.allfunctions)
// Handles single and batch requests where parameters are passed in the body.
router.post('/api/update/write', handlers.handlePostMultiUpdate)
router.post('/apiupdate/write', handlers.handlePostMultiUpdate)
// Placeholder, not actually really used.
router.delete('/api/delete', handlers.handleDelete)
module.exports = router