From 3a4f0e8bc2e6e7d2f1ca5d53c929c3e22a22e7f1 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 4 May 2024 22:51:19 +0200 Subject: [PATCH] fix style and dev debug --- scripts/server-backend.js | 8 ++++---- scripts/server-frontend-dev.js | 3 +-- scripts/server.js | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/server-backend.js b/scripts/server-backend.js index 0747cc2..b3925a3 100644 --- a/scripts/server-backend.js +++ b/scripts/server-backend.js @@ -208,7 +208,7 @@ export default function startBackendServer(port) { * * @apiSuccess {String} body returns "done" as text * @apiError {Number} 401 Unauthorized - * + * * @apiExample {curl} Example usage to draw a circle: * curl -i http://[rootUrl]/api/drawToWhiteboard?wid=[MyWhiteboardId]&t=circle&d=[388,201,100]&th=4 */ @@ -230,13 +230,13 @@ export default function startBackendServer(port) { broadcastTo(readOnlyId); try { query.th = parseFloat(query.th); - } catch(e) { + } catch (e) { //Dont do a thing } try { - query.d = JSON.parse(query.d) - } catch(e) { + query.d = JSON.parse(query.d); + } catch (e) { //Dont do a thing } s_whiteboard.handleEventsAndData(query); //save whiteboardchanges on the server diff --git a/scripts/server-frontend-dev.js b/scripts/server-frontend-dev.js index 30544b3..f4b15af 100644 --- a/scripts/server-frontend-dev.js +++ b/scripts/server-frontend-dev.js @@ -15,12 +15,11 @@ const devServerConfig = { }, }; -export default function then(port, resolve) { +export default function startFrontendDevServer(port, resolve) { new WebpackDevServer(webpack(config), devServerConfig).start(port, (err) => { if (err) { console.log(err); } - console.log("Listening on port " + port); }); resolve(1); diff --git a/scripts/server.js b/scripts/server.js index d526cd9..4c3c542 100644 --- a/scripts/server.js +++ b/scripts/server.js @@ -1,5 +1,6 @@ import { getArgs } from "./utils.js"; import startBackendServer from "./server-backend.js"; +import startFrontendDevServer from "./server-frontend-dev.js"; const SERVER_MODES = { PRODUCTION: 1, @@ -21,7 +22,7 @@ const server_mode = args.mode === "production" ? SERVER_MODES.PRODUCTION : SERVE if (server_mode === SERVER_MODES.DEVELOPMENT) { console.info("Starting server in development mode."); - import("./server-frontend-dev.js").then(function () { + startFrontendDevServer(8080, function () { // 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);