Spaces:
Paused
Paused
Update server.js
Browse files
server.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
| 1 |
const express = require('express');
|
| 2 |
-
const
|
| 3 |
|
| 4 |
const app = express();
|
| 5 |
|
| 6 |
app.get('/*', (req, res) => {
|
| 7 |
const url = 'https://platform.openai.com' + req.url;
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
});
|
| 11 |
|
| 12 |
const port = 8080; // Выберите любой свободный порт
|
|
|
|
| 1 |
const express = require('express');
|
| 2 |
+
const https = require('https');
|
| 3 |
|
| 4 |
const app = express();
|
| 5 |
|
| 6 |
app.get('/*', (req, res) => {
|
| 7 |
const url = 'https://platform.openai.com' + req.url;
|
| 8 |
|
| 9 |
+
https.get(url, (response) => {
|
| 10 |
+
response.pipe(res);
|
| 11 |
+
}).on('error', (err) => {
|
| 12 |
+
console.error(err);
|
| 13 |
+
res.status(500).send('Ошибка проксирования');
|
| 14 |
+
});
|
| 15 |
});
|
| 16 |
|
| 17 |
const port = 8080; // Выберите любой свободный порт
|