2020-02-18 23:55:06 -05:00
|
|
|
const express = require('express');
|
2024-10-09 04:05:15 -04:00
|
|
|
const jwtdecode = require('../lib/express/jwt-decode');
|
|
|
|
const internalReport = require('../internal/report');
|
2020-02-18 23:55:06 -05:00
|
|
|
|
|
|
|
let router = express.Router({
|
|
|
|
caseSensitive: true,
|
|
|
|
strict: true,
|
|
|
|
mergeParams: true
|
|
|
|
});
|
|
|
|
|
|
|
|
router
|
|
|
|
.route('/hosts')
|
2024-10-09 04:05:15 -04:00
|
|
|
.options((_, res) => {
|
2020-02-18 23:55:06 -05:00
|
|
|
res.sendStatus(204);
|
|
|
|
})
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GET /reports/hosts
|
|
|
|
*/
|
2024-10-09 04:05:15 -04:00
|
|
|
.get(jwtdecode(), (_, res, next) => {
|
2020-02-18 23:55:06 -05:00
|
|
|
internalReport.getHostsReport(res.locals.access)
|
|
|
|
.then((data) => {
|
|
|
|
res.status(200)
|
|
|
|
.send(data);
|
|
|
|
})
|
|
|
|
.catch(next);
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = router;
|