@tunframework/tun-bodyparser
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

tun-bodyparser

bodyparser for tun

install

npm install @tunframework/tun{,-bodyparser}

example

import { TunApplication } from '@tunframework/tun'
import { bodyparser } from '@tunframework/tun-bodyparser'

const app = new TunApplication()
app.use(bodyparser())
app.use(async (ctx, next) => {
  const data = ctx.req.body
  return { data }
})
const server = app.listen({ host: '127.0.0.1', port: 0 })

server.on('listening', async () => {
  // @type {AddressInfo}
  let addr = server.address() || {}
  console.log(`listening: http://${addr.address}:${addr.port}`)
})

/@tunframework/tun-bodyparser/

    Package Sidebar

    Install

    npm i @tunframework/tun-bodyparser

    Weekly Downloads

    1

    Version

    2.0.5

    License

    ISC

    Unpacked Size

    10.3 kB

    Total Files

    6

    Last publish

    Collaborators

    • cn-ia