The main server, and probably only repository in this org.
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

5 years ago
  1. const fs = require("fs");
  2. const proxy = require("http-proxy-middleware");
  3. let config = {url: "http://10.12.121.228:8100/"};
  4. try {
  5. const data = fs.readFileSync("./proxy.json", "utf-8");
  6. config = JSON.parse(data)
  7. } catch(err) {
  8. console.error("Failed to load proxy.json in project root");
  9. }
  10. module.exports = function(app) {
  11. app.use(proxy('/api/ws', { target: config.url, ws: true }));
  12. app.use(proxy('/api', { target: config.url, ws: false }));
  13. };