0.1.0 • Published 4 years ago

hyper-fluture v0.1.0

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

hyper-fluture

monadic http middleware based on hyper-ts.

  • uses flutures instead of promises
  • not indexed

install

npm install hyper-fluture

hello world

import * as express from 'express'
import * as H from 'hyper-fluture'
import { toRequestHandler } from 'hyper-fluture/lib/express'
import { pipe } from 'fp-ts/lib/pipeable'

const hello: H.Middleware<never, void> = pipe(
  H.status(H.Status.OK), // writes the response status
  H.chain(() => H.send('Hello hyper-fluture on express!')) // sends the response as text
)

express()
  .get('/', toRequestHandler(hello))
  .listen(3000, () => console.log('Express listening on port 3000. Use: GET /'))