# @aios-medical/bullmq-dashboard-express 中文文档

规范地址：https://npmcn.com/package/%40aios-medical/bullmq-dashboard-express/

版本：1\.0\.2
npm 元数据更新时间：2026-06-05T17:37:52.374Z
中文译文更新时间：2026-11-08T05:20:29.249Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40aios-medical/bullmq-dashboard-express
原文对照：https://npmcn.com/package/%40aios-medical/bullmq-dashboard-express/?lang=original
项目主页：https://github.com/fellahealth/aios-bullmq-dashboard#readme
源码仓库：https://github.com/fellahealth/aios-bullmq-dashboard

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：22.7 kB，14 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- 运行依赖：4 个
- 首次发布：2026-05-27T20:28:02.278Z
- 最新版本发布：2026-06-05T17:37:51.960Z
- 近 30 天下载量：1896（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：3（近 12 个月 3 个）

## 中文简介

Express.js 为aios bullmq仪表板的服务器适配器.

## 安装

```sh
npm install @aios-medical/bullmq-dashboard-express
```

也可以使用：`pnpm add @aios-medical/bullmq-dashboard-express`、`yarn add @aios-medical/bullmq-dashboard-express`、`bun add @aios-medical/bullmq-dashboard-express`

## README

# @aios-medical/bullmq-dashboard-expressed (中文(简体) )

Express.js AIOS BullMQ Dashboard的服务器适配器.

![AIOS BullMQ Dashboard overview](https://raw.githubusercontent.com/fellahealth/aios-bullmq-dashboard/main/screenshots/overview.png)

## 安装

```bash
npm install @aios-medical/bullmq-dashboard-express
# or
yarn add @aios-medical/bullmq-dashboard-express
# or
pnpm add @aios-medical/bullmq-dashboard-express
```

## 概览

这个软件包为服务于AIOS BullMQ Dashboard提供了一个Express.js适配器. 它处理路由,中间软件集成,并为静态UI资产服务.

## 使用量

### 基本设置

```typescript
import express from 'express';
import { createDashboard } from '@aios-medical/bullmq-dashboard-api';
import { BullMQAdapter } from '@aios-medical/bullmq-dashboard-api/bullMQAdapter';
import { ExpressAdapter } from '@aios-medical/bullmq-dashboard-express';
import { Queue } from 'bullmq';

const app = express();

// Create your BullMQ queue
const queue = new Queue('my-queue', { 
  connection: { host: 'localhost', port: 6379 } 
});

// Create the Express adapter
const serverAdapter = new ExpressAdapter();
serverAdapter.setBasePath('/admin/queues');

// Create the dashboard
createDashboard({
  queues: [new BullMQAdapter(queue)],
  serverAdapter,
  options: {
    uiConfig: {
      title: 'My Queue Dashboard',
      subtitle: 'Production',
    },
  },
});

// Mount the dashboard
app.use('/admin/queues', serverAdapter.getRouter());

app.listen(3000, () => {
  console.log('Dashboard running on http://localhost:3000/admin/queues');
});
```

### 与公牛(列格西语)

```typescript
import express from 'express';
import { createDashboard } from '@aios-medical/bullmq-dashboard-api';
import { BullAdapter } from '@aios-medical/bullmq-dashboard-api/bullAdapter';
import { ExpressAdapter } from '@aios-medical/bullmq-dashboard-express';
import Queue from 'bull';

const app = express();

const queue = new Queue('my-queue', { 
  redis: { host: 'localhost', port: 6379 } 
});

const serverAdapter = new ExpressAdapter();
serverAdapter.setBasePath('/admin/queues');

createDashboard({
  queues: [new BullAdapter(queue)],
  serverAdapter,
  options: {
    uiConfig: {
      title: 'My Queue Dashboard',
    },
  },
});

app.use('/admin/queues', serverAdapter.getRouter());

app.listen(3000);
```

### 多个队列

```typescript
const emailQueue = new Queue('emails', { connection: { host: 'localhost', port: 6379 } });
const reportQueue = new Queue('reports', { connection: { host: 'localhost', port: 6379 } });

const serverAdapter = new ExpressAdapter();
serverAdapter.setBasePath('/admin/queues');

createDashboard({
  queues: [
    new BullMQAdapter(emailQueue, { displayName: 'Email Queue' }),
    new BullMQAdapter(reportQueue, { displayName: 'Report Queue' }),
  ],
  serverAdapter,
  options: {
    uiConfig: {
      title: 'Production Queues',
    },
  },
});

app.use('/admin/queues', serverAdapter.getRouter());
```

### 有认证

```typescript
import basicAuth from 'express-basic-auth';

const serverAdapter = new ExpressAdapter();
serverAdapter.setBasePath('/admin/queues');

createDashboard({
  queues: [new BullMQAdapter(queue)],
  serverAdapter,
  options: {
    uiConfig: {
      title: 'Protected Dashboard',
    },
  },
});

// Add authentication middleware
app.use('/admin/queues', basicAuth({
  challenge: true,
  users: { admin: process.env.DASHBOARD_PASSWORD || 'secret' },
}));

app.use('/admin/queues', serverAdapter.getRouter());
```

### 自定义中端软件

在安装仪表板之前, 您可以添加任何 Express 中间软件 :

```typescript
const serverAdapter = new ExpressAdapter();
serverAdapter.setBasePath('/admin/queues');

// Rate limiting
import rateLimit from 'express-rate-limit';

const limiter = rateLimit({
  windowMs: 15 * 60 * 1000, // 15 minutes
  max: 100 // limit each IP to 100 requests per windowMs
});

app.use('/admin/queues', limiter);

// CORS
import cors from 'cors';
app.use('/admin/queues', cors());

// Mount dashboard
app.use('/admin/queues', serverAdapter.getRouter());
```

## API 参考

### 运算符

特快适配器配置主班.

#### 构造器

```typescript
constructor()
```

创建新的 ExpressAdapter 实例, 并附带一个内部 Express app .

#### 方法

##### 设置BasePath(路径:字符串)

设置仪表盘路线的基础路径.

```typescript
serverAdapter.setBasePath('/admin/queues');
```

##### 设置StaticPath( StaticRoute: 字符串, 静态Path: 字符串)

为 UI 资产配置静态文件 .

```typescript
serverAdapter.setStaticPath('/static', '/path/to/dist/static');
```

##### 设置 PUPHPath( 视图Path: 字符串)

设置 EJS 模板的视图路径.

```typescript
serverAdapter.setViewsPath('/path/to/dist');
```

##### 设置 ErrorHandler( 处理器 : (错误: 错误) 控制器 Handler ReturnValue

设置 API 路由的错误处理器.

```typescript
serverAdapter.setErrorHandler((error) => {
  return {
    status: 500,
    body: { error: error.message }
  };
});
```

##### 设置队列( 队列登记: 队列登记)

设置队列注册( 称为 : `createDashboard`) (中文(简体) ).

```typescript
serverAdapter.setQueues(queueRegistry);
```

##### 设置 UIConfig( 配置: UIConfig)

设置用户界面配置(称为自动配置) `createDashboard`) (中文(简体) ).

```typescript
serverAdapter.setUIConfig({
  title: 'My Dashboard',
  subtitle: 'Production',
});
```

##### 获取鲁特( )

返回要挂入您的应用程序的快递路由器 .

```typescript
app.use('/admin/queues', serverAdapter.getRouter());
```

## 配置

适配器通过 `createDashboard` 函数来自 API 软件包。 所有 UI 配置都通过 `options.uiConfig` 参数 :

```typescript
createDashboard({
  queues: [new BullMQAdapter(queue)],
  serverAdapter,
  options: {
    uiConfig: {
      title: 'My Dashboard',
      subtitle: 'Production',
      environment: {
        label: 'Production',
        color: '#ef4444',
      },
      pollingInterval: {
        forceInterval: 5000,
      },
      miscLinks: [
        { text: 'Docs', url: 'https://docs.example.com' },
      ],
      hideRedisDetails: false,
    },
  },
});
```

## 高级使用

### 嵌入式路线

您可以在现有路线下嵌入仪表板:

```typescript
const apiRouter = express.Router();
const serverAdapter = new ExpressAdapter();
serverAdapter.setBasePath('/dashboard');

createDashboard({
  queues: [new BullMQAdapter(queue)],
  serverAdapter,
});

apiRouter.use('/dashboard', serverAdapter.getRouter());
app.use('/api/v1', apiRouter);

// Dashboard available at /api/v1/dashboard
```

### 自定义错误处理

```typescript
serverAdapter.setErrorHandler((error) => {
  console.error('Dashboard error:', error);
  
  return {
    status: 500,
    body: {
      error: 'Internal server error',
      message: process.env.NODE_ENV === 'development' ? error.message : undefined,
    },
  };
});
```

### 多个实例

您可以运行多个不同配置的仪表板实例 :

```typescript
const prodAdapter = new ExpressAdapter();
prodAdapter.setBasePath('/admin/prod-queues');

createDashboard({
  queues: [new BullMQAdapter(prodQueue)],
  serverAdapter: prodAdapter,
  options: {
    uiConfig: { title: 'Production Queues' },
  },
});

const devAdapter = new ExpressAdapter();
devAdapter.setBasePath('/admin/dev-queues');

createDashboard({
  queues: [new BullMQAdapter(devQueue)],
  serverAdapter: devAdapter,
  options: {
    uiConfig: { title: 'Development Queues' },
  },
});

app.use('/admin/prod-queues', prodAdapter.getRouter());
app.use('/admin/dev-queues', devAdapter.getRouter());
```

## 依赖关系

-   **表达式**: ^ 4.2.1.2 (中文(简体) )
-   **简况**: ^ 3.1.10 (韩语)
-   **@aios-medical/bullmq-dashboard-api (英语)**: ^ 1.0.0 (中文(简体) )
-   **@aios-medical/bullmq-dashboard-ui (英语)**: ^ 1.0.0 (中文(简体) )

## 许可证

麻省理工学院

## 相关软件包

-   [@aios-medical/bullmq-dashboard-api (英语)](https://www.npmjs.com/package/@aios-medical/bullmq-dashboard-api) - 核心API软件包
-   [@aios-medical/bullmq-dashboard-ui (英语)](https://www.npmjs.com/package/@aios-medical/bullmq-dashboard-ui) - 反应UI组件
-   [@aios-medical/bullmq-dashboard-nesstjs (英语)](https://www.npmjs.com/package/@aios-medical/bullmq-dashboard-nestjs) - 雀巢JS模块

## 常见问题

### @aios-medical/bullmq-dashboard-express 是什么？

Express\.js 为aios bullmq仪表板的服务器适配器\.

### 如何安装 @aios-medical/bullmq-dashboard-express？

在项目目录运行 npm install @aios-medical/bullmq-dashboard-express，或使用 pnpm add / yarn add / bun add。

### @aios-medical/bullmq-dashboard-express 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @aios-medical/bullmq-dashboard-express 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @aios-medical/bullmq-dashboard-express 可以商用吗？

@aios-medical/bullmq-dashboard-express 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @aios-medical/bullmq-dashboard-express 的下载量有多少？

根据 npm 官方下载统计，@aios-medical/bullmq-dashboard-express 在 2026/10/05 – 2026/11/03 这 30 天内被下载 1,896 次，日均约 63 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @aios-medical/bullmq-dashboard-express 还在维护吗？

最新版本 1\.0\.2 发布于 2026/06/06（5 个月前）；至今共发布 3 个版本，其中过去 12 个月发布了 3 个；首次发布于 2026/05/28。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

