Create /logs/ api endpoint
This commit is contained in:
parent
43f578d311
commit
8ce22eca95
3 changed files with 156 additions and 146 deletions
|
|
@ -191,6 +191,17 @@ app.get('/api/logs/:deviceId', (req, res, next) => {
|
|||
.catch(next)
|
||||
})
|
||||
|
||||
app.get('/api/logs', (req, res, next) => {
|
||||
return machineLoader.getMachines()
|
||||
.then(machines => {
|
||||
const firstMachine = _.first(machines)
|
||||
if (!firstMachine) return res.status(404).send({Error: 'No machines'})
|
||||
return logs.getMachineLogs(firstMachine.deviceId)
|
||||
.then(r => res.send(r))
|
||||
})
|
||||
.catch(next)
|
||||
})
|
||||
|
||||
/**
|
||||
* Endpoint for patching customer's data
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue