Certificates into their own section

This commit is contained in:
Jamie Curnow
2018-08-07 20:27:20 +10:00
parent 1c57ccdc87
commit c749a22b52
41 changed files with 599 additions and 385 deletions

View File

@ -147,38 +147,4 @@ router
.catch(next);
});
/**
* Specific proxy-host Certificates
*
* /api/nginx/proxy-hosts/123/certificates
*/
router
.route('/:host_id/certificates')
.options((req, res) => {
res.sendStatus(204);
})
.all(jwtdecode()) // preferred so it doesn't apply to nonexistent routes
/**
* POST /api/nginx/proxy-hosts/123/certificates
*
* Upload certifications
*/
.post((req, res, next) => {
if (!req.files) {
res.status(400)
.send({error: 'No files were uploaded'});
} else {
internalProxyHost.setCerts(res.locals.access, {
id: parseInt(req.params.host_id, 10),
files: req.files
})
.then(result => {
res.status(200)
.send(result);
})
.catch(next);
}
});
module.exports = router;