From 01955bea1e88d8d4ec59586a7608a11c9a06f88c Mon Sep 17 00:00:00 2001 From: Daniel Ledda Date: Mon, 22 Mar 2021 10:27:27 +0100 Subject: [PATCH] dev env --- dashboard/src/config.json | 2 +- server/src/main.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dashboard/src/config.json b/dashboard/src/config.json index e122349..aa37043 100644 --- a/dashboard/src/config.json +++ b/dashboard/src/config.json @@ -2,5 +2,5 @@ "development": true, "defaultMinuteSpan": 60, "reloadIntervalSec": 30, - "dataEndpoint": "/climate/api" + "dataEndpoint": "http://tortedda.local/climate/api" } diff --git a/server/src/main.ts b/server/src/main.ts index c1cc429..1e4e0a1 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -16,9 +16,11 @@ async function main() { const app = express(); app.use(express.json()); if (process.env.DEV) { - app.use(cors({ - origin: "http://192.168.0.181/" - })); + const corsMiddleware = cors({ + origin: "http://localhost:3000/" + }); + app.use(corsMiddleware); + app.options("*", corsMiddleware); } app.set("port", process.env.PORT || 3000); app.use(express.urlencoded({ extended: false}));