Last active
March 11, 2024 03:27
-
-
Save rollendxavier/07c9c85a854acbb3eb0a9df10a8a64f3 to your computer and use it in GitHub Desktop.
Price Tracker - express.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const axios = require('axios'); | |
const app = express(); | |
app.get('/api/v3/coins/:id/history', (req, res) => { | |
const url = `https://api.coingecko.com/api/v3/coins/${req.params.id}/history`; | |
axios.get(url, { | |
params: req.query, | |
headers: { | |
'X-CoinAPI-Key': '‘YOUR_API_KEY' | |
} | |
}) | |
.then(response => { | |
res.json(response.data); | |
}) | |
.catch(error => { | |
res.send(error.message); | |
}); | |
}); | |
app.listen(3001, () => console.log('Proxy server running on port 3001')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment