From ffff0899cc8b97280743c549f5206d262562a5a3 Mon Sep 17 00:00:00 2001 From: Florent Chehab Date: Sun, 19 Apr 2020 18:14:44 +0200 Subject: [PATCH] docs: updated README * and small documentation changes --- README.md | 8 ++++++-- config/webpack.dev.js | 2 +- scripts/server-frontend-dev.js | 1 + scripts/server.js | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 48cb648..25507c7 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,18 @@ You can run this app with and without docker ### Without Docker 1. install the latest NodeJs 2. Clone the app -3. Run `npm i` inside the folder -4. Run `node server.js` +3. Run `npm ci` inside the folder +4. Run `npm run start:prod` 5. Surf to http://YOURIP:8080 ### With Docker 1. `docker run -d -p 8080:8080 rofl256/whiteboard` 2. Surf to http://YOURIP:8080 +## Development + +After you have installed the app, run `npm run start:dev` to lunch the backend and a frontend development server. The website will be accessible on http://locahost:8080. + ## Default keyboard shortcuts Use keyboard shortcuts to become more productive while using Whiteboard. diff --git a/config/webpack.dev.js b/config/webpack.dev.js index 3b20fa3..a919e81 100644 --- a/config/webpack.dev.js +++ b/config/webpack.dev.js @@ -11,7 +11,7 @@ const devConfig = merge(baseConfig, { plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.NamedModulesPlugin(), - new webpack.NoEmitOnErrorsPlugin(), // don't reload if there is an error + new webpack.NoEmitOnErrorsPlugin(), ].concat(baseConfig.plugins), }); diff --git a/scripts/server-frontend-dev.js b/scripts/server-frontend-dev.js index 0773b76..0e90065 100644 --- a/scripts/server-frontend-dev.js +++ b/scripts/server-frontend-dev.js @@ -6,6 +6,7 @@ const devServerConfig = { maxModules: 0 }, proxy: { + // proxies for the backend '/api': 'http://localhost:3000', '/uploads': 'http://localhost:3000', '/ws-api': { diff --git a/scripts/server.js b/scripts/server.js index 06478c6..8e74668 100644 --- a/scripts/server.js +++ b/scripts/server.js @@ -18,6 +18,8 @@ const server_mode = args.mode === "production" ? SERVER_MODES.PRODUCTION : SERVE if (server_mode === SERVER_MODES.DEVELOPMENT){ console.info("Starting server in development mode."); startFrontendDevServer(8080); + // this time, it's the frontend server that is on port 8080 + // requests for the backend will be proxied to prevent cross origins errors startBackendServer(3000); } else { console.info("Starting server in production mode.");