UNPKG

@adonisjs/bodyparser

Version:

AdonisJs body parser to read and parse HTTP request bodies

34 lines (33 loc) 1.02 kB
"use strict"; /* * @adonisjs/bodyparser * * (c) Harminder Virk <virk@adonisjs.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ Object.defineProperty(exports, "__esModule", { value: true }); class BodyParserProvider { constructor(app) { this.app = app; } /** * Registers the bodyparser middleware namespace to the container. */ register() { this.app.container.bind('Adonis/Core/BodyParser', () => { const { BodyParserMiddleware } = require('../src/BodyParser/index'); return BodyParserMiddleware; }); } /** * Adding the `file` macro to add support for reading request files. */ boot() { const extendRequest = require('../src/Bindings/Request').default; extendRequest(this.app.container.resolveBinding('Adonis/Core/Request')); } } exports.default = BodyParserProvider; BodyParserProvider.needsApplication = true;