feat: endpoints for machine network performance
This commit is contained in:
parent
4003d892fd
commit
4772024e3d
2 changed files with 32 additions and 0 deletions
29
lib/routes/performanceRoutes.js
Normal file
29
lib/routes/performanceRoutes.js
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue