Vladimir Alabov
commited on
Commit
•
5603394
1
Parent(s):
56643f6
updated 4
Browse files
server.js
CHANGED
@@ -1,12 +1,11 @@
|
|
1 |
const express = require('express');
|
2 |
const proxy = require('express-http-proxy');
|
3 |
const app = express();
|
4 |
-
const targetUrl = 'https://
|
5 |
-
// const openaiKey = process.env.OPENAI_KEY
|
6 |
const port = 7860;
|
7 |
-
const baseUrl = '
|
8 |
|
9 |
-
app.use('/
|
10 |
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
|
11 |
// Modify the request headers if necessary
|
12 |
// proxyReqOpts.headers['Authorization'] = 'Bearer '+openaiKey;
|
@@ -14,19 +13,6 @@ app.use('/api', proxy(targetUrl, {
|
|
14 |
},
|
15 |
}));
|
16 |
|
17 |
-
app.get("/", (req, res) => {
|
18 |
-
res.send(`This is your ORP URL: ${baseUrl}`);
|
19 |
-
});
|
20 |
-
|
21 |
-
function getExternalUrl(spaceId) {
|
22 |
-
try {
|
23 |
-
const [username, spacename] = spaceId.split("/");
|
24 |
-
return `https://${username}-${spacename.replace(/_/g, "-")}.hf.space/api/v1`;
|
25 |
-
} catch (e) {
|
26 |
-
return "";
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
app.listen(port, () => {
|
31 |
console.log(`Reverse proxy server running on ${baseUrl}`);
|
32 |
});
|
|
|
1 |
const express = require('express');
|
2 |
const proxy = require('express-http-proxy');
|
3 |
const app = express();
|
4 |
+
const targetUrl = 'https://www.bing.com';
|
|
|
5 |
const port = 7860;
|
6 |
+
const baseUrl = 'bing';
|
7 |
|
8 |
+
app.use('/', proxy(targetUrl, {
|
9 |
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
|
10 |
// Modify the request headers if necessary
|
11 |
// proxyReqOpts.headers['Authorization'] = 'Bearer '+openaiKey;
|
|
|
13 |
},
|
14 |
}));
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
app.listen(port, () => {
|
17 |
console.log(`Reverse proxy server running on ${baseUrl}`);
|
18 |
});
|