Skip to content

Commit 7724211

Browse files
committed
Updating routing to see if we can remove the redirect.
1 parent 06c66f3 commit 7724211

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

routes/data.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,27 @@ var router = express.Router()
1010

1111
var handlers = require('../handlers/data_handlers')
1212

13-
router.get('/', (req, res) => {
14-
res.redirect('/api')
15-
})
16-
1713
router.get('/healthwatch', function (req, res, next) {
1814
res.status(200).json(
1915
{ 'response': 'Okay' }
2016
)
2117
})
2218

2319
// Runs, but pulls only from URL query parameters. (Check if this is being used)
24-
router.get('/api/update', handlers.handleGetUpdate)
20+
router.get('/update', handlers.handleGetUpdate)
2521

26-
router.get('/api/logs/:lines', handlers.handleLogs)
27-
router.get('/api/logs', handlers.handleLogs)
22+
router.get('/logs/:lines', handlers.handleLogs)
23+
router.get('/logs', handlers.handleLogs)
2824

2925
// Populates the dojo API. Returns all API endpoints/Postgres functions.
30-
router.get('/api', handlers.allfunctions)
31-
router.post('/api', handlers.allfunctions)
26+
router.get('/', handlers.allfunctions)
27+
router.post('/', handlers.allfunctions)
3228

3329
// Handles single and batch requests where parameters are passed in the body.
34-
router.post('/api/update/write', handlers.handlePostMultiUpdate)
30+
router.post('/update/write', handlers.handlePostMultiUpdate)
3531
router.post('/apiupdate/write', handlers.handlePostMultiUpdate)
3632

3733
// Placeholder, not actually really used.
38-
router.delete('/api/delete', handlers.handleDelete)
34+
router.delete('/delete', handlers.handleDelete)
3935

4036
module.exports = router

tilia-api.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ app.use(express.static(path.join(__dirname, 'public')))
9292
var data = require('./routes/data.js')
9393

9494
app.use('/', data)
95+
app.use('/api', data)
9596
app.use('/healthcheck/', healthwatch);
9697

9798
app.all('*', function (req, res) {

0 commit comments

Comments
 (0)