mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 14:59:29 -07:00
feat: add proxy routes
This commit is contained in:
parent
ee60af395a
commit
e0d47e5247
1 changed files with 34 additions and 0 deletions
|
@ -92,6 +92,40 @@ router.get(
|
|||
}
|
||||
)
|
||||
|
||||
// ASPE route
|
||||
router.get('/aspe', query('aspeUri').isString(), (req, res) => {
|
||||
const errors = validationResult(req)
|
||||
if (!errors.isEmpty()) {
|
||||
return res.status(400).json({ errors: errors.array() })
|
||||
}
|
||||
|
||||
fetcher.aspe
|
||||
.fn(req.query, opts)
|
||||
.then((data) => {
|
||||
return res.status(200).send(data)
|
||||
})
|
||||
.catch((err) => {
|
||||
return res.status(400).json({ errors: err.message ? err.message : err })
|
||||
})
|
||||
})
|
||||
|
||||
// OpenPGP route
|
||||
router.get('/openpgp', query('url').isFQDN(), query('protocol').isString(), (req, res) => {
|
||||
const errors = validationResult(req)
|
||||
if (!errors.isEmpty()) {
|
||||
return res.status(400).json({ errors: errors.array() })
|
||||
}
|
||||
|
||||
fetcher.openpgp
|
||||
.fn(req.query, opts)
|
||||
.then((data) => {
|
||||
return res.status(200).send(data)
|
||||
})
|
||||
.catch((err) => {
|
||||
return res.status(400).json({ errors: err.message ? err.message : err })
|
||||
})
|
||||
})
|
||||
|
||||
// DNS route
|
||||
router.get('/dns', query('domain').isFQDN(), (req, res) => {
|
||||
const errors = validationResult(req)
|
||||
|
|
Loading…
Reference in a new issue