Setup QueueDash with Express
mainTo integrate QueueDash into an Express application, install @queuedash/api and use the createQueueDashExpressMiddleware function. You must provide a ctx object containing an array of queues. Each queue object requires the queue instance, a displayName, and a type (one of bull, bullmq, bee, or groupmq).
import express from "express";
import Bull from "bull";
import { createQueueDashExpressMiddleware } from "@queuedash/api";
const app = express();
const reportQueue = new Bull("report-queue");
app.use(
"/queuedash",
createQueueDashExpressMiddleware({
ctx: {
queues: [
{
queue: reportQueue,
displayName: "Reports",
type: "bull" as const,
},
],
},
}),
);
app.listen(3000, () => {
console.log("Listening on port 3000");
console.log("Visit http://localhost:3000/queuedash");
});import express from "express";
import Bull from "bull";
import { createQueueDashExpressMiddleware } from "@queuedash/api";
const app = express();
const reportQueue = new Bull("report-queue");
app.use(
"/queuedash",
createQueueDashExpressMiddleware({
ctx: {
queues: [
{
queue: reportQueue,
displayName: "Reports",
type: "bull" as const,
},
],
},
}),
);
app.listen(3000, () => {
console.log("Listening on port 3000");
console.log("Visit http://localhost:3000/queuedash");
});