feat: endpoints for machine network performance

This commit is contained in:
Sérgio Salgado 2021-05-26 15:20:46 +01:00 committed by Josh Harvey
parent 4003d892fd
commit 4772024e3d
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,29 @@
const express = require('express')
const router = express.Router()
const { getMachine } = require('../machine-loader')
function networkHeartbeat (req, res, next) {
return getMachine(req.deviceId)
.then(machine => {
console.log(`${machine.name} network heartbeat:`)
console.log(req.body)
return res.status(200).send({ status: 'OK' })
})
.catch(next)
}
function networkPerformance (req, res, next) {
return getMachine(req.deviceId)
.then(machine => {
console.log(`${machine.name} network performance:`)
console.log(req.body)
return res.status(200).send({ status: 'OK' })
})
.catch(next)
}
router.post('/heartbeat', networkHeartbeat)
router.post('/performance', networkPerformance)
module.exports = router