mirror of
https://github.com/xiaoxinpro/nginx-proxy-manager-zh.git
synced 2025-01-22 12:58:13 -05:00
dfe2588523
- /schema now returns full openapi/swagger schema - That schema is used to validate incoming requests - And used as a contract in future integration tests - Moved route files up one level - Fixed incorrect 404 reponses when getting objects - Fixed saving new objects and passing jsonschemavalidation
30 lines
572 B
JavaScript
30 lines
572 B
JavaScript
const express = require('express');
|
|
const jwtdecode = require('../lib/express/jwt-decode');
|
|
const internalReport = require('../internal/report');
|
|
|
|
let router = express.Router({
|
|
caseSensitive: true,
|
|
strict: true,
|
|
mergeParams: true
|
|
});
|
|
|
|
router
|
|
.route('/hosts')
|
|
.options((_, res) => {
|
|
res.sendStatus(204);
|
|
})
|
|
|
|
/**
|
|
* GET /reports/hosts
|
|
*/
|
|
.get(jwtdecode(), (_, res, next) => {
|
|
internalReport.getHostsReport(res.locals.access)
|
|
.then((data) => {
|
|
res.status(200)
|
|
.send(data);
|
|
})
|
|
.catch(next);
|
|
});
|
|
|
|
module.exports = router;
|