Skip to content

Commit

Permalink
Use webpack proxy for API access
Browse files Browse the repository at this point in the history
  • Loading branch information
phile314 committed Nov 9, 2017
1 parent 4b25971 commit edea563
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ backend ? (import ./../backend {})
, pkgs ? (import ./../pkgs.nix) {}
, backendURL ? "http://localhost:8080" }:
, backendURL ? "http://localhost:3000/api" }:

with pkgs;

Expand Down
6 changes: 6 additions & 0 deletions frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ module.exports = {
inline: true,
stats: 'errors-only',
historyApiFallback: true,
proxy: {
"/api": {
target: "http://localhost:8080",
pathRewrite: {"^/api" : ""}
}
},
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
Expand Down

0 comments on commit edea563

Please sign in to comment.