Skip to content

hoa-js/json

Repository files navigation

@hoajs/json

JSON response formatting middleware for Hoa.

Installation

$ npm i @hoajs/json --save

Quick Start

import { Hoa } from 'hoa'
import { json } from '@hoajs/json'

const app = new Hoa()
app.use(json())

app.use(async (ctx) => {
  ctx.res.body = 'Hello, Hoa!'
})

export default app

Response:

{
  code: 200,
  data: 'Hello, Hoa!'
}

Documentation

The documentation is available on hoa-js.com

Test (100% coverage)

$ npm test

License

MIT

About

JSON response formatting middleware for Hoa.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published