Skip to content

hoa-js/formidable

Repository files navigation

@hoajs/formidable

Formidable middleware for Hoa. Parses multipart/form-data requests using formidable, designed for use with @hoajs/adapter in Node.js environment.

Installation

$ npm i @hoajs/formidable --save

Quick Start

import { Hoa } from 'hoa'
import { nodeServer } from '@hoajs/adapter'
import { hoaFormidable } from '@hoajs/formidable'

const app = new Hoa()
app.extend(nodeServer())
app.use(hoaFormidable())

app.use(async (ctx) => {
  const fields = ctx.req.body   // parsed form fields
  const files = ctx.req.files   // uploaded files
  ctx.res.body = { fields, files }
})

app.listen(3000)

Documentation

The documentation is available on hoa-js.com

Test (100% coverage)

$ npm test

License

MIT

About

FormData parser middleware for Hoa.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors