UNPKG

@xtcry/bull-arena

Version:

An interactive UI dashboard for Bee/Bull Queue

27 lines (26 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = void 0; const path = require("path"); const express = require("express"); const server_1 = require("./server"); const routes_1 = require("./server/controllers/routes"); function run(config, listenOptions = {}) { var _a; const { app, queues } = server_1.default(config); queues.useCdn = (_a = listenOptions.useCdn) !== null && _a !== void 0 ? _a : true; app.locals.appBasePath = listenOptions.basePath || app.locals.appBasePath; app.use(app.locals.appBasePath, express.static(path.join(__dirname, '../', 'public'))); app.use(app.locals.appBasePath, routes_1.default); const { port = 4567, // Default: listen to all network interfaces. host = '0.0.0.0', disableListen, } = listenOptions; if (!disableListen) { app.listen(port, host, () => { console.log(`Arena is running on port ${port} at host ${host}`); }); } return { app, queues }; } exports.run = run; exports.default = (config, listenOpts = {}) => run(config, listenOpts).app;