Skip to content

Commit

Permalink
feat: add simple cors proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
bonustrack committed Aug 26, 2024
1 parent 674af37 commit 6c83365
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,22 @@ router.post('/nft-claimer/mint', async (req, res) => {
}
});

router.get('/proxy/:url', async (req, res) => {
const { url } = req.params;

try {
const response = await fetch(url);

return res.json(await response.json());
} catch (e: any) {
capture(e);
res.status(500).json({
error: {
code: 500,
message: 'failed to fetch URL'
}
});
}
});

export default router;

0 comments on commit 6c83365

Please sign in to comment.