Spaces:
Running
Running
const express = require('express'); | |
const https = require('https'); | |
const app = express(); | |
app.get('/*', (req, res) => { | |
const url = 'https://platform.openai.com' + req.url; | |
https.get(url, (response) => { | |
response.pipe(res); | |
}).on('error', (err) => { | |
console.error(err); | |
res.status(500).send('Ошибка проксирования'); | |
}); | |
}); | |
const port = 8080; // Выберите любой свободный порт | |
app.listen(port, () => { | |
console.log(`Прокси-сервер запущен на порту ${port}`); | |
}); |