Class: Server

Server(router)

Server handles listening to a host and port, passing request data to Router routes, and passing a respondWith method to registered routes.

Constructor

new Server(router)

Create a Server instance.
Parameters:
Name Type Description
router Router The Router to be used for this Server
Source:

Methods

start(host, port) → {Promise}

Start this Server for a host on a port.
Parameters:
Name Type Default Description
host string localhost The host
port number 1337 The port
Source:
Returns:
A promise that resolves when the server has started
Type
Promise

stop() → {Promise}

Stops the server.
Source:
Returns:
A promise that resolves when the server has stopped
Type
Promise