UNPKG

@thisismissem/adonisjs-respond-with

Version:

A small plugin for Adonis.js to make responding with different content-types easier.

21 lines (20 loc) 593 B
import { Negotiator } from '../src/negotiator.js'; export default class RespondWithProvider { app; constructor(app) { this.app = app; } async boot() { await import('../src/extension.js'); } register() { this.app.container.singleton(Negotiator, async () => { const config = this.app.config.get('respond_with', { defaultHandler: 'error', mappings: {}, }); return new Negotiator(config); }); this.app.container.alias('respondWith.negotiator', Negotiator); } }