ninomae1001
commited on
Commit
•
65fafd9
1
Parent(s):
5fc4a8a
Update server.js
Browse files
server.js
CHANGED
@@ -1,16 +1,13 @@
|
|
1 |
const express = require('express');
|
2 |
-
const
|
3 |
-
|
4 |
const app = express();
|
5 |
-
|
6 |
-
app.use('/',
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
'^/proxy': '/',
|
11 |
},
|
12 |
}));
|
13 |
-
|
14 |
const port = 7860;
|
15 |
app.listen(port, () => {
|
16 |
console.log(`Reverse proxy server listening on port ${port}`);
|
|
|
1 |
const express = require('express');
|
2 |
+
const proxy = require('express-http-proxy');
|
|
|
3 |
const app = express();
|
4 |
+
const targetUrl = 'https://integrate.api.nvidia.com'; // OpenAI API endpoint
|
5 |
+
app.use('/hf/', 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}`);
|