UNPKG

@das3mical/adonis-mercure

Version:

Mercure Hub integration for AdonisJS v6 — publish real-time updates via Server-Sent Events (SSE)

19 lines (18 loc) 685 B
import '../src/types/extended.js'; import { Mercure } from '../src/mercure.js'; import { MercureConfigError } from '../src/errors/config_error.js'; export default class MercureProvider { app; constructor(app) { this.app = app; } async boot() { this.app.container.singleton('mercure', async () => { const config = this.app.config.get('mercure'); if (!config?.endpoint || !config?.adminToken || !config?.jwt?.secret) { throw new MercureConfigError('Missing or incomplete Mercure config. Run "node ace configure @das3mical/adonis-mercure"'); } return new Mercure(config); }); } }