cycle-http-server-driver
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-alpha.4 • Public • Published

cycle-http-server-driver

In alpha.

An HTTP server driver for CycleJS for managing request/response in Node.js.

Installation

npm install cycle-http-server-driver --save

Documentation

Usage

import transport from 'http'
 
import {
  makeHTTPServerDriver
} from 'cycle-http-server-driver'
 
import bunyan from 'bunyan'
 
const port = 8080
const logger = bunyan.createLogger({name: 'web'})
const transport = makeHTTPServerTransport()
 
const drivers = {
  HTTPServer: makeHTTPServerDriver(port, logger, transport)
}
 
function main (sources) {
  return {
    HTTPServer: sources.HTTPServer.map((context) => {
      return {
        ...context,
        headers: {'Content-Type': 'text/html'},
        body: 'Hello, world!'
      }
    })
  }
}
 
run(main, drivers)

Readme

Keywords

none

Package Sidebar

Install

npm i cycle-http-server-driver

Weekly Downloads

4

Version

0.0.1-alpha.4

License

MIT

Last publish

Collaborators

  • mariuslundgard