From 653800b8ac17556ad5870685ec69647b55a4f4a1 Mon Sep 17 00:00:00 2001 From: Sander Hautvast Date: Fri, 2 Feb 2024 09:41:54 +0100 Subject: [PATCH] Create web-dev-server.md what I ran into with web-dev-server --- cmd/web-dev-server.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 cmd/web-dev-server.md diff --git a/cmd/web-dev-server.md b/cmd/web-dev-server.md new file mode 100644 index 0000000..a13a626 --- /dev/null +++ b/cmd/web-dev-server.md @@ -0,0 +1,31 @@ +start server with reload + +`wds -c web-demo-server.config.mjs --watch` + +Who would have though that the mocks that were setup used cookies to communicate with the client +So I had to resort to deleting them because otherwise the cookies of the previous run were still in. +After the reset new values are probably used. TODO verify that. + +I took out the customer specifics here (middleware) + +```javascript +import ... + +/// removing the cookies makes sure the mocks work allright +const removeCookies = () => { + return async (context, next) => { + // console.log(context); // can be turned on for debugging + context.request.header.cookie=""; + return next(); + }; +}; + +export default { + open: 'demo', + nodeResolve: true, + middleware: [ + removeCookies(), + ] +}; + +```