From 65f49f10729ee2e56c0b3b93100b53b8cdcb136e Mon Sep 17 00:00:00 2001 From: Felix Mosheev <9304194+felixmosh@users.noreply.github.com> Date: Wed, 23 Jun 2021 23:21:05 +0300 Subject: [PATCH] fix: fix @bull-board/ui paths, closes #300 --- examples/with-express/index.js | 2 +- packages/api/src/index.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/with-express/index.js b/examples/with-express/index.js index 4fdd5121..2aa11eff 100644 --- a/examples/with-express/index.js +++ b/examples/with-express/index.js @@ -67,7 +67,7 @@ const run = async () => { app.listen(3000, () => { console.log('Running on 3000...'); - console.log('For the UI of instance1, open http://localhost:3000/ui'); + console.log('For the UI, open http://localhost:3000/ui'); console.log('Make sure Redis is running on port 6379 by default'); console.log('To populate the queue, run:'); console.log(' curl http://localhost:3000/add?title=Example'); diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index b0d3f3ba..c0394ade 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -13,11 +13,12 @@ export function createBullBoard({ serverAdapter: IServerAdapter; }) { const { bullBoardQueues, setQueues, replaceQueues, addQueue, removeQueue } = getQueuesApi(queues); + const uiBasePath = path.dirname(require.resolve('@bull-board/ui/package.json')); serverAdapter .setQueues(bullBoardQueues) - .setViewsPath(path.resolve('node_modules/@bull-board/ui/dist')) - .setStaticPath('/static', path.resolve('node_modules/@bull-board/ui/dist/static')) + .setViewsPath(path.join(uiBasePath, 'dist')) + .setStaticPath('/static', path.join(uiBasePath, 'dist/static')) .setEntryRoute(appRoutes.entryPoint) .setErrorHandler(errorHandler) .setApiRoutes(appRoutes.api);