Angular pwa, how can I make http-server (running on localhost:8080) to work with a nodejs server running on localhost:3333?
Asked Answered
S

0

7

When I serve the web-app on port 3330, I can make the webapp working on port 3333 using --proxy ./src/proxy.config.json, but I don't know how to make http-server to make to work at the same way

"start": "ng serve -o --port 3330 --watch --proxy-config ./src/proxy.config.json",
"pwa": "http-server -p 8080 -c-1 dist/satoshi-pwa --proxy http://localhost:3333",

proxy.config.json:

{
  "/api": {
    "target": "http://localhost:3333",
    "secure": false,
    "changeOrigin": true,
    "pathRewrite": {
      "^/api": "/"
    }
  }
}

environment.ts:

export const environment = {
  production: true,
  apiUrl: 'http://localhost:3333/api'
};
Salesclerk answered 21/6, 2020 at 21:15 Comment(4)
Do you find a solution?Astilbe
I am also looking solution for this issue. Did you find any solution for this?Toiletry
is there any other server that will be useful for this scenario?Toiletry
@BohdanSkochko no I haven'tSalesclerk

© 2022 - 2024 — McMap. All rights reserved.