Create server.js
Browse files
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 |
+
});
|