1.0.0 • Published 6 years ago

the-http v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

The HTTP (TH)

A toolkit to help build HTTP service.

Features

  • Modern: Using async/await instead of callback
  • Simple: Simple function model: async (request) => response
  • Extensible: Via making and composing intuitive wrappers
  • Standard: Just HTTP
  • Micro: Suitable for micro service

Categories

Install

npm i --save the-http

Getting Started

const {Response, compose, handleErrors, listen} = require('the-http') 

async function handler(request) {
  const {name, age} = await request.body.asJSON()
  return Response.withJSONBody({
    isAdult: age >= 18,
    message: `Hello ${name}`
  })
}

const enhancedHandler = compose(
  handleErrors()
)(handler)

listen(3000)(enhancedHandler)

See RequestBody, Request, Response and more in API doc.

License

MIT

1.0.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago