From 52c264973163ba45352029878d0d87708109aab9 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 20 Apr 2022 11:06:47 +0200 Subject: [PATCH] fix: moleculer web errata see [moleculer-web/issues/#308](https://github.com/moleculerjs/moleculer-web/issues/308) --- source/docs/0.14/moleculer-web.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/source/docs/0.14/moleculer-web.md b/source/docs/0.14/moleculer-web.md index 423a9d6c4..6a39f403b 100644 --- a/source/docs/0.14/moleculer-web.md +++ b/source/docs/0.14/moleculer-web.md @@ -214,10 +214,6 @@ You can't request the `/math.add` or `/math/add` URLs, only `POST /add`. ### File upload aliases API Gateway has implemented file uploads. You can upload files as a multipart form data (thanks to [busboy](https://github.com/mscdex/busboy) library) or as a raw request body. In both cases, the file is transferred to an action as a `Stream`. In multipart form data mode you can upload multiple files, as well. -{% note warn %} -Please note, you have to disable other body parsers in order to accept files. -{% endnote %} - **Example** ```js const ApiGateway = require("moleculer-web"); @@ -231,12 +227,6 @@ module.exports = { { path: "", - // You should disable body parsers - bodyParsers: { - json: false, - urlencoded: false - }, - aliases: { // File upload from HTML multipart form "POST /": "multipart:file.save", @@ -273,8 +263,8 @@ module.exports = { In order to access the files passed by multipart-form these specific fields can be used inside the action: - `ctx.params` is the Readable stream containing the file passed to the endpoint -- `ctx.params.$params` parameters from URL querystring -- `ctx.meta.$multipart` contains the additional text form-data fields passed _before other files fields_. +- `ctx.meta.$params` parameters from URL querystring +- `ctx.meta.$multipart` contains the additional text form-data fields _must be sent before other files fields_. ### Auto-alias The auto-alias feature allows you to declare your route alias directly in your services. The gateway will dynamically build the full routes from service schema.