UNPKG

adonisjs-swagger

Version:
20 lines (19 loc) 582 B
import { setupSwagger } from '../index.js'; import { RuntimeException } from '@poppinss/utils'; import { configProvider } from '@adonisjs/core'; export default class SwaggerProvider { app; constructor(app) { this.app = app; } register() { this.app.container.singleton('swagger', () => this); } async start() { const config = await configProvider.resolve(this.app, this.app.config.get('swagger')); if (!config) { throw new RuntimeException('Missing swagger config'); } setupSwagger(config); } }