feat(Dev proxy) : Add proxy to localhost:8080 in dev mode.
This commit is contained in:
parent
b24b5e20b4
commit
61ba50fac9
3 changed files with 38 additions and 2 deletions
|
@ -1,4 +1,15 @@
|
||||||
const conf = require('./gulp.conf');
|
const conf = require('./gulp.conf');
|
||||||
|
const proxy = require('http-proxy-middleware');
|
||||||
|
|
||||||
|
const apiProxy = proxy('/api', {
|
||||||
|
target: 'http://localhost:8080',
|
||||||
|
changeOrigin: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const healthProxy = proxy('/health', {
|
||||||
|
target: 'http://localhost:8080',
|
||||||
|
changeOrigin: true
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
return {
|
return {
|
||||||
|
@ -6,6 +17,10 @@ module.exports = function () {
|
||||||
baseDir: [
|
baseDir: [
|
||||||
conf.paths.tmp,
|
conf.paths.tmp,
|
||||||
conf.paths.src
|
conf.paths.src
|
||||||
|
],
|
||||||
|
middleware: [
|
||||||
|
apiProxy,
|
||||||
|
healthProxy
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
open: false
|
open: false
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
"gulp-util": "^3.0.7",
|
"gulp-util": "^3.0.7",
|
||||||
"html-loader": "^0.4.3",
|
"html-loader": "^0.4.3",
|
||||||
"html-webpack-plugin": "^2.9.0",
|
"html-webpack-plugin": "^2.9.0",
|
||||||
|
"http-proxy-middleware": "^0.17.4",
|
||||||
"isparta-loader": "^2.0.0",
|
"isparta-loader": "^2.0.0",
|
||||||
"jasmine": "^2.4.1",
|
"jasmine": "^2.4.1",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ camelcase@^1.0.2, camelcase@^1.2.1:
|
||||||
version "1.2.1"
|
version "1.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
|
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
|
||||||
|
|
||||||
camelcase@^2.0.0:
|
camelcase@^2.0.0, camelcase@^2.0.1:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
|
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
|
||||||
|
|
||||||
|
@ -3034,6 +3034,15 @@ http-errors@~1.5.0:
|
||||||
setprototypeof "1.0.1"
|
setprototypeof "1.0.1"
|
||||||
statuses ">= 1.3.0 < 2"
|
statuses ">= 1.3.0 < 2"
|
||||||
|
|
||||||
|
http-proxy-middleware@^0.17.4:
|
||||||
|
version "0.17.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.17.4.tgz#642e8848851d66f09d4f124912846dbaeb41b833"
|
||||||
|
dependencies:
|
||||||
|
http-proxy "^1.16.2"
|
||||||
|
is-glob "^3.1.0"
|
||||||
|
lodash "^4.17.2"
|
||||||
|
micromatch "^2.3.11"
|
||||||
|
|
||||||
http-proxy@1.15.1, http-proxy@^1.13.0:
|
http-proxy@1.15.1, http-proxy@^1.13.0:
|
||||||
version "1.15.1"
|
version "1.15.1"
|
||||||
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.15.1.tgz#91a6088172e79bc0e821d5eb04ce702f32446393"
|
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.15.1.tgz#91a6088172e79bc0e821d5eb04ce702f32446393"
|
||||||
|
@ -3041,6 +3050,13 @@ http-proxy@1.15.1, http-proxy@^1.13.0:
|
||||||
eventemitter3 "1.x.x"
|
eventemitter3 "1.x.x"
|
||||||
requires-port "1.x.x"
|
requires-port "1.x.x"
|
||||||
|
|
||||||
|
http-proxy@^1.16.2:
|
||||||
|
version "1.16.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.16.2.tgz#06dff292952bf64dbe8471fa9df73066d4f37742"
|
||||||
|
dependencies:
|
||||||
|
eventemitter3 "1.x.x"
|
||||||
|
requires-port "1.x.x"
|
||||||
|
|
||||||
http-signature@~0.11.0:
|
http-signature@~0.11.0:
|
||||||
version "0.11.0"
|
version "0.11.0"
|
||||||
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-0.11.0.tgz#1796cf67a001ad5cd6849dca0991485f09089fe6"
|
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-0.11.0.tgz#1796cf67a001ad5cd6849dca0991485f09089fe6"
|
||||||
|
@ -3905,6 +3921,10 @@ lodash@^4.0.0, lodash@^4.0.1, lodash@^4.14.0, lodash@^4.16.4, lodash@^4.2.0, lod
|
||||||
version "4.17.1"
|
version "4.17.1"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.1.tgz#e75eaf17a34730c6491d9956f4d81f3a044f01bf"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.1.tgz#e75eaf17a34730c6491d9956f4d81f3a044f01bf"
|
||||||
|
|
||||||
|
lodash@^4.17.2:
|
||||||
|
version "4.17.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||||
|
|
||||||
lodash@~4.16.4:
|
lodash@~4.16.4:
|
||||||
version "4.16.6"
|
version "4.16.6"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.16.6.tgz#d22c9ac660288f3843e16ba7d2b5d06cca27d777"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.16.6.tgz#d22c9ac660288f3843e16ba7d2b5d06cca27d777"
|
||||||
|
@ -4021,7 +4041,7 @@ merge@^1.1.3:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da"
|
resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da"
|
||||||
|
|
||||||
micromatch@2.3.11, micromatch@^2.1.5, micromatch@^2.3.7:
|
micromatch@2.3.11, micromatch@^2.1.5, micromatch@^2.3.11, micromatch@^2.3.7:
|
||||||
version "2.3.11"
|
version "2.3.11"
|
||||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
|
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
Loading…
Reference in a new issue