Skip to content

Commit

Permalink
elysia style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Nov 13, 2024
1 parent 0654e19 commit 5408c73
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
8 changes: 4 additions & 4 deletions examples/with-elysia/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createBullBoard } from '@bull-board/api';
import { BullMQAdapter } from '@bull-board/api/bullMQAdapter';
import { ElysiaAdapter } from '@bull-board/elysia';
import { ElysiaAdapter } from '../../node_modules/@bull-board/elysia';
import { Queue as QueueMQ, Worker } from 'bullmq';
import Elysia from 'elysia';

Expand All @@ -14,7 +14,7 @@ const redisOptions = {

const createQueueMQ = (name: string) => new QueueMQ(name, { connection: redisOptions });

async function setupBullMQProcessor(queueName: string) {
function setupBullMQProcessor(queueName: string) {
new Worker(
queueName,
async (job) => {
Expand All @@ -34,7 +34,7 @@ async function setupBullMQProcessor(queueName: string) {

const exampleBullMq = createQueueMQ('BullMQ');

await setupBullMQProcessor(exampleBullMq.name);
setupBullMQProcessor(exampleBullMq.name);

const serverAdapter = new ElysiaAdapter('/ui');

Expand All @@ -46,7 +46,7 @@ createBullBoard({
const app = new Elysia()
.onError(({ error, code, request }) => {
console.error(error, code, request.method, request.url);
if(code === "NOT_FOUND") return "NOT_FOUND";
if (code === 'NOT_FOUND') return 'NOT_FOUND';
})
.use(serverAdapter.registerPlugin())
.get('/add', async ({ query }) => {
Expand Down
23 changes: 23 additions & 0 deletions packages/elysia/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# <img alt="@bull-board" src="https://raw.githubusercontent.com/felixmosh/bull-board/master/packages/ui/src/static/images/logo.svg" width="35px" /> @bull-board/elysia

[Elysia](https://expressjs.com/) server adapter for `bull-board`.

<p align="center">
<a href="https://www.npmjs.com/package/@bull-board/express">
<img alt="npm version" src="https://img.shields.io/npm/v/@bull-board/express">
</a>
<a href="https://www.npmjs.com/package/bull-board">
<img alt="npm downloads" src="https://img.shields.io/npm/dw/bull-board">
</a>
<a href="https://github.com/vcapretz/bull-board/blob/master/LICENSE">
<img alt="licence" src="https://img.shields.io/github/license/vcapretz/bull-board">
</a>
<p>

![Overview](https://raw.githubusercontent.com/felixmosh/bull-board/master/screenshots/overview.png)
![UI](https://raw.githubusercontent.com/felixmosh/bull-board/master/screenshots/dashboard.png)

# Usage examples
1. [Simple express setup](https://github.com/felixmosh/bull-board/tree/master/examples/with-elysia)

For more info visit the main [README](https://github.com/felixmosh/bull-board#readme)
11 changes: 5 additions & 6 deletions packages/elysia/src/ElysiaAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export class ElysiaAdapter implements IServerAdapter {
name: '@bull-board/elysia',
}).as('plugin');
private basePath = '';
private entryRoute: AppViewRoute | undefined;
private statics: { path: string; route: string } | undefined;
private bullBoardQueues: BullBoardQueues | undefined;
private viewPath: string | undefined;
private uiConfig: UIConfig = {};

constructor(basePath = '') {
if (basePath.length) {
Expand All @@ -26,12 +31,6 @@ export class ElysiaAdapter implements IServerAdapter {
}
}

private entryRoute: AppViewRoute | undefined;
private statics: { path: string; route: string } | undefined;
private bullBoardQueues: BullBoardQueues | undefined;
private viewPath: string | undefined;
private uiConfig: UIConfig = {};

public setStaticPath(staticsRoute: string, staticsPath: string): ElysiaAdapter {
this.statics = { route: staticsRoute, path: staticsPath };

Expand Down

0 comments on commit 5408c73

Please sign in to comment.