Fred0828 commited on
Commit
095a061
1 Parent(s): a26969b

Create server.js

Browse files
Files changed (1) hide show
  1. server.js +14 -0
server.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const express = require('express');
2
+ const proxy = require('express-http-proxy');
3
+ const app = express();
4
+ const targetUrl = 'https://api.openai.com'; // OpenAI API endpoint
5
+ app.use('/', proxy(targetUrl, {
6
+ proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
7
+ // Modify the request headers if necessary
8
+ return proxyReqOpts;
9
+ },
10
+ }));
11
+ const port = 7860;
12
+ app.listen(port, () => {
13
+ console.log(`Reverse proxy server listening on port ${port}`);
14
+ });