Formidable middleware for Hoa. Parses multipart/form-data requests using formidable, designed for use with @hoajs/adapter in Node.js environment.
$ npm i @hoajs/formidable --saveimport { 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)The documentation is available on hoa-js.com
$ npm testMIT