From e0d47e5247cb0f9090fb0a26b1deac121db21669 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Tue, 23 Jan 2024 19:34:17 +0100 Subject: [PATCH] feat: add proxy routes --- src/api/v3/proxy_get.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/api/v3/proxy_get.js b/src/api/v3/proxy_get.js index a766735..5addc17 100644 --- a/src/api/v3/proxy_get.js +++ b/src/api/v3/proxy_get.js @@ -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)