You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
456 B
15 lines
456 B
const fs = require("fs");
|
|
const proxy = require("http-proxy-middleware");
|
|
|
|
let config = {url: "http://10.12.121.228:8100/"};
|
|
try {
|
|
const data = fs.readFileSync("./proxy.json", "utf-8");
|
|
config = JSON.parse(data)
|
|
} catch(err) {
|
|
console.error("Failed to load proxy.json in project root");
|
|
}
|
|
|
|
module.exports = function(app) {
|
|
app.use(proxy('/api/ws', { target: config.url, ws: true }));
|
|
app.use(proxy('/api', { target: config.url, ws: false }));
|
|
};
|