Introduced in 4.0.0

Stability: 1 - Experimental

const HyperText = require('kado/lib/HyperText')

This library provides an abstraction layer for use with Kado system that provides the framework for multiple web servers to register for live I/O use within the system.

There is a HyperTextEngine library that provides the needed implementation to setup traditional web servers into this abstraction layer.

Class: HyperText

HyperText extends Connect see Connect for more engine management and more.

static HyperText.getInstance()

static HyperText.logRequest (app, options)

Available Options

Example Usage

if (process.env.NODE_ENV !== 'production') {

HyperText.start(port, host)


Class: HyperTextEngine

HyperTextEngine extends ConnectEngine see ConnectEngine for engine management and more.


Must be extended and used to start the underlying server.


Must be extended and used to stop the underlying server.

Class: HyperTextServer

HyperTextServer extends HyperTextEngine and provides a complete HTTP web server for use with Application

static HyperTextServer.finalHandler(req, res)

Default finalHandler route.

Internal Use






Use to create the actual underlying HTTP server after all settings have been applied.

Will then set the provided router using the setRouter(router) method below.


This is typically called by Application during setupHyperText()

Internal Use


HyperTextServer.onRequest(req, res)

This method is set to the request event the server generates.

Internal Use

Class: StaticServer

Provides a basic static file server to be used as middleware.

static StaticServer.getMiddleware (root, options)

StaticServer.constructor(root, options)


StaticServer.request(req, res)

Class: Proxy

static Proxy.pass(req, res, options)

Available options:

Class: WebSocket

This class requires the ws module to be installed. Afterwards, this class provides WebSocket support backed by the Kado HyperText engine.

The class has one user accessible method which is the register method

WebSocket.register(app, sessionParser)

To use this module it needs to be activated by adding it to your application like so

const WebSocket = require('kado/lib/HyperText').WebSocket
// add a session handler
app.use((req) => { req.cookie = Parser.cookie('' + req.headers.cookie) })
const sessionParser = Session.getMiddleware({
secret: cfg.main.cookieSecret || 'acme-admin',
store: new Session.SessionStoreLocal()
// attach inline websocket server to http engine and sessions
WebSocket.register(app, sessionParser)