Description
Middleware parses request body with multipart/form-data
content type and prepares an array of objects which represent every file which is sent in request. On the server side you will be able to get that array from req.formData
property (see an example below). Every array item will contain data
property which is a Buffer.
Using
-
Make a simple Express.js server in
index.js
file:const app = ;const parseMp = ;app;app; -
Run it:
node index.js -
Make a
POST
request using any tool you want and send any file (-s) onhttp://localhost:3000/upload
route. Check console to see the parsed result.
req.formData
Example of