Rooni commited on
Commit
3c0cf05
·
verified ·
1 Parent(s): 2ffd947

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +12 -9
server.js CHANGED
@@ -1,13 +1,16 @@
1
  const express = require('express');
2
- const proxy = require('express-http-proxy');
 
3
  const app = express();
4
- const targetUrl = 'https://platform.openai.com/playground';
5
- app.use('/', proxy(targetUrl, {
6
- proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
7
- return proxyReqOpts;
8
- },
9
- }));
10
- const port = 7860;
 
 
11
  app.listen(port, () => {
12
- console.log(`Reverse proxy server listening on port ${port}`);
13
  });
 
1
  const express = require('express');
2
+ const request = require('request');
3
+
4
  const app = express();
5
+
6
+ app.get('/*', (req, res) => {
7
+ const url = 'https://platform.openai.com' + req.url;
8
+
9
+ req.pipe(request(url)).pipe(res);
10
+ });
11
+
12
+ const port = 8080; // Выберите любой свободный порт
13
+
14
  app.listen(port, () => {
15
+ console.log(`Прокси-сервер запущен на порту ${port}`);
16
  });