Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bull-board/api

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bull-board/api

Core server APIs of bull-board

  • 4.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
254K
decreased by-19.66%
Maintainers
1
Weekly downloads
 
Created

What is @bull-board/api?

@bull-board/api is a package that provides a user interface and API for managing and monitoring Bull queues. It allows developers to visualize and control their job queues, making it easier to track job statuses, retry failed jobs, and manage job lifecycles.

What are @bull-board/api's main functionalities?

Setting up Bull Board

This code sets up Bull Board with an Express server. It creates a Bull queue and integrates it with Bull Board, making the queue accessible via a web interface at '/admin/queues'.

const { createBullBoard } = require('@bull-board/api');
const { BullAdapter } = require('@bull-board/api/bullAdapter');
const Queue = require('bull');

const someQueue = new Queue('someQueueName');

const { router } = createBullBoard([
  new BullAdapter(someQueue)
]);

// Express setup
const express = require('express');
const app = express();
app.use('/admin/queues', router);
app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

Adding multiple queues

This code demonstrates how to add multiple Bull queues to Bull Board. It creates two queues and integrates them with Bull Board, making both queues accessible via the web interface.

const { createBullBoard } = require('@bull-board/api');
const { BullAdapter } = require('@bull-board/api/bullAdapter');
const Queue = require('bull');

const firstQueue = new Queue('firstQueue');
const secondQueue = new Queue('secondQueue');

const { router } = createBullBoard([
  new BullAdapter(firstQueue),
  new BullAdapter(secondQueue)
]);

// Express setup
const express = require('express');
const app = express();
app.use('/admin/queues', router);
app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

Customizing Bull Board

This code shows how to customize Bull Board by dynamically adding or replacing queues. The `setQueues` and `replaceQueues` methods allow for flexible queue management.

const { createBullBoard } = require('@bull-board/api');
const { BullAdapter } = require('@bull-board/api/bullAdapter');
const Queue = require('bull');

const someQueue = new Queue('someQueueName');

const { router, setQueues, replaceQueues } = createBullBoard([
  new BullAdapter(someQueue)
]);

// Express setup
const express = require('express');
const app = express();
app.use('/admin/queues', router);
app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

// Later in the code, you can dynamically add or replace queues
const anotherQueue = new Queue('anotherQueueName');
setQueues([new BullAdapter(anotherQueue)]);

Other packages similar to @bull-board/api

Keywords

FAQs

Package last updated on 28 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc