@sugo/body-parser-form-data-multipart
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

@sugo/body-parser-form-data-multipart

Middleware for parsing form-data, www-form-urlencoded or multipart type requests

How to install

npm install --save @sugo/body-parser-form-data-multipart

SuGoFormDataMultipartBodyParser

Builds the middleware. Receives formidable form options

Example - Node Http Server

import { getMiddleware, IRequest } from '@sugo/body-parser-form-data-multipart';
const parseBody = getMiddleware();
const server = http.createServer(async (req: IRequest, res: http.ServerResponse) => {
  await parseBody(req, res);
  res.writeHead(200, headers);
  res.end(JSON.stringify(req.body));
});

Example - SuGo Server

import { createServer, SuGoRequest, SuGoResponse } from '@sugo/server';
import { getMiddleware, IRequest } from '@sugo/body-parser-form-data-multipart';
const server = createServer((req: SuGoRequest, res: SuGoResponse) => {
  res.writeHead(200, headers);
  res.end(JSON.stringify(req.body ? req.body : {}));
}).useMiddleware(getMiddleware());

Readme

Keywords

Package Sidebar

Install

npm i @sugo/body-parser-form-data-multipart

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

18.2 kB

Total Files

11

Last publish

Collaborators

  • andrea.sucre
  • franciscojsucreg