diff --git a/docker-compose.yml b/docker-compose.yml index 9287a4ef9..932adf22e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,6 +23,7 @@ services: - /dev/bus/usb:/dev/bus/usb ports: - "1935:1935" + - "3000:3000" - "5000:5000" - "5001:5001" - "8080:8080" diff --git a/web/config/handlers.js b/web/config/handlers.js index d9cf5dd0d..323de2e14 100644 --- a/web/config/handlers.js +++ b/web/config/handlers.js @@ -2,7 +2,7 @@ import { rest } from 'msw'; import { API_HOST } from '../src/env'; export const handlers = [ - rest.get(`${API_HOST}/api/config`, (req, res, ctx) => { + rest.get(`${API_HOST}api/config`, (req, res, ctx) => { return res( ctx.status(200), ctx.json({ @@ -35,7 +35,7 @@ export const handlers = [ }) ); }), - rest.get(`${API_HOST}/api/stats`, (req, res, ctx) => { + rest.get(`${API_HOST}api/stats`, (req, res, ctx) => { return res( ctx.status(200), ctx.json({ @@ -54,7 +54,7 @@ export const handlers = [ }) ); }), - rest.get(`${API_HOST}/api/events`, (req, res, ctx) => { + rest.get(`${API_HOST}api/events`, (req, res, ctx) => { return res( ctx.status(200), ctx.json( diff --git a/web/package.json b/web/package.json index 21b50468c..e6d727d60 100644 --- a/web/package.json +++ b/web/package.json @@ -3,7 +3,7 @@ "private": true, "version": "0.0.0", "scripts": { - "dev": "vite", + "dev": "vite --host", "lint": "eslint ./ --ext .jsx,.js,.tsx,.ts", "build": "tsc && vite build --base=/BASE_PATH/", "preview": "vite preview", diff --git a/web/src/__mocks__/env.js b/web/src/__mocks__/env.js index 5d7b8a452..7ff1a2ac7 100644 --- a/web/src/__mocks__/env.js +++ b/web/src/__mocks__/env.js @@ -1,2 +1,2 @@ export const ENV = 'test'; -export const API_HOST = 'http://base-url.local:5000'; +export const API_HOST = 'http://base-url.local:5000/'; diff --git a/web/src/api/__tests__/index.test.jsx b/web/src/api/__tests__/index.test.jsx index 434a944a6..0c871766e 100644 --- a/web/src/api/__tests__/index.test.jsx +++ b/web/src/api/__tests__/index.test.jsx @@ -18,6 +18,6 @@ describe('useApiHost', () => { ); - expect(screen.queryByText('http://base-url.local:5000')).toBeInTheDocument(); + expect(screen.queryByText('http://base-url.local:5000/')).toBeInTheDocument(); }); }); diff --git a/web/src/env.js b/web/src/env.js index 5c830581e..99fd57635 100644 --- a/web/src/env.js +++ b/web/src/env.js @@ -1,2 +1,2 @@ export const ENV = import.meta.env.MODE; -export const API_HOST = ENV === "production" ? "" : "http://localhost:5000"; +export const API_HOST = ENV === 'production' ? '' : 'http://localhost:5000/';