import fetch from 'node-fetch' import express from 'express' const app = express() const db = '../db' const port = 3102 app.get('/ETH/:date', async (req, res) => { const response = await fetch(`https://api.coingecko.com/api/v3/coins/ethereum/history?date=${req.params.date}`) const data = await response.json() res.send(data.market_data.current_price.rub.toString()) }) app.get('/TRX/:date', async (req, res) => { const response = await fetch(`https://api.coingecko.com/api/v3/coins/tron/history?date=${req.params.date}`) const data = await response.json() res.send(data.market_data.current_price.rub.toString()) }) app.listen(port, () => { console.log(`App listening on port ${port}`) }) process .on('unhandledRejection', () => {}) .on('uncaughtException', () => {})