From bb4bebaee6e6be400be72ea5134c4f26286ffc84 Mon Sep 17 00:00:00 2001 From: Tim Weber Date: Wed, 3 Apr 2019 18:28:50 +0200 Subject: [PATCH] Make API port configurable and add documentation --- vue/README.md | 8 ++++++++ vue/src/router.js | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/vue/README.md b/vue/README.md index ec8524bf..c3767b9f 100644 --- a/vue/README.md +++ b/vue/README.md @@ -10,6 +10,14 @@ npm install npm run serve ``` +Change the port Vue binds to via the `--port` parameter. +Use the `VUE_APP_API_PORT` environment variable to point Vue to the JHipster API port. +For example, to specify both settings: + +``` +VUE_APP_API_PORT=45678 npm run serve -- --port=2345 +``` + ### Compiles and minifies for production ``` npm run build diff --git a/vue/src/router.js b/vue/src/router.js index c2d7d766..70064e57 100644 --- a/vue/src/router.js +++ b/vue/src/router.js @@ -5,7 +5,9 @@ import HSAdmin from "./hsadmin.js" Vue.use(Router); -const hsa = new HSAdmin(); +const hsa = new HSAdmin({ + baseURL: `http://localhost:${process.env.VUE_APP_API_PORT || 8080}/api`, +}); const routeProps = (route) => { return Object.assign({}, route.params,{ hsadmin: hsa