From db263b8db4da67df0f327e5deaf68f3d7c3f2401 Mon Sep 17 00:00:00 2001 From: softsimon Date: Sat, 10 Apr 2021 11:33:01 +0400 Subject: [PATCH] Proxy contributor requests. --- backend/src/index.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/backend/src/index.ts b/backend/src/index.ts index 82608b8d5..bcfa03534 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -178,6 +178,24 @@ class Server { res.status(500).end(); } }) + .get(config.MEMPOOL.API_URL_PREFIX + 'contributors', async (req, res) => { + try { + const response = await axios.get('https://mempool.space/api/v1/contributors', { responseType: 'stream', timeout: 10000 }); + response.data.pipe(res); + } catch (e) { + res.status(500).end(); + } + }) + .get(config.MEMPOOL.API_URL_PREFIX + 'contributors/images/:id', async (req, res) => { + try { + const response = await axios.get('https://mempool.space/api/v1/contributors/images/' + req.params.id, { + responseType: 'stream', timeout: 10000 + }); + response.data.pipe(res); + } catch (e) { + res.status(500).end(); + } + }) ; if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED) {