Skip to content

Commit 85df3a6

Browse files
committed
Webpack: development and production environments
1 parent 8b53c09 commit 85df3a6

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ npm install
2020
npm run dev
2121
```
2222

23-
By default, the build configuration assumes you have the backend available at `localhost:5000`. Change the `CB_ENDPOINT` value according to your setup (e.g. different location, production, static ip of a real RPi running the backend) in the `config/dev.eng.js` file.
23+
By default, the (development) build configuration assumes you have the backend available at `localhost:5000`. Change the `CB_ENDPOINT` value according to your setup (e.g. different location, production, static ip of a real RPi running the backend) in the `config/dev.env.js` file.
2424

25-
To serve in production, change `CB_ENDPOINT` to `'""'` and
25+
While in production environment, it assumes you are serving the vue app from the backend, thus having `CB_ENDPOINT` to a blank string.
2626

2727
```bash
2828
# build the web application
@@ -31,7 +31,7 @@ npm run build
3131
mv dist ../coderbot/
3232
```
3333

34-
At this point, the Flask backend serves the built application at `/vue`.
34+
At this point, run the backend and Flask will serve the built Vue app at `/vue`.
3535

3636
Another build value you may want to edit it's `assetsPublicPath` in `config/index.js`, which allows to serve the application from a subfolder.
3737

config/dev.env.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
const merge = require('webpack-merge')
33
const prodEnv = require('./prod.env')
44

5-
// Beware, changes in this files require a new build.
5+
// Beware, changes in this files require a new build.
66
// I.e. `npm run dev` is not aware of changes made here.
77

88
module.exports = merge(prodEnv, {
99
NODE_ENV: '"development"',
1010
// Backend location. Must point to the exposed Flask instance
1111
// By default, if you run the backend locally, it's available at localhost:5000
12-
// If you run the Vue app in production, served by the Flask backend, it should be '""'
1312
CB_ENDPOINT: '"http://localhost:5000"',
1413
// Legacy APIs
1514
APIv1: '""',

config/prod.env.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
'use strict'
22
module.exports = {
3-
NODE_ENV: '"production"'
3+
NODE_ENV: '"production"',
4+
// Backend location. Must point to the exposed Flask instance
5+
CB_ENDPOINT: '""',
6+
// Legacy APIs
7+
APIv1: '""',
8+
// New API, exposed by Connexion
9+
APIv2: '"/v2"'
410
}

0 commit comments

Comments
 (0)