UNPKG

1.02 kBJavaScriptView Raw
1"use strict";
2/*
3 * @adonisjs/bodyparser
4 *
5 * (c) Harminder Virk <virk@adonisjs.com>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10Object.defineProperty(exports, "__esModule", { value: true });
11class BodyParserProvider {
12 constructor(app) {
13 this.app = app;
14 }
15 /**
16 * Registers the bodyparser middleware namespace to the container.
17 */
18 register() {
19 this.app.container.bind('Adonis/Core/BodyParser', () => {
20 const { BodyParserMiddleware } = require('../src/BodyParser/index');
21 return BodyParserMiddleware;
22 });
23 }
24 /**
25 * Adding the `file` macro to add support for reading request files.
26 */
27 boot() {
28 const extendRequest = require('../src/Bindings/Request').default;
29 extendRequest(this.app.container.resolveBinding('Adonis/Core/Request'));
30 }
31}
32exports.default = BodyParserProvider;
33BodyParserProvider.needsApplication = true;