GETTING STARTED

MAIN CONCEPTS

API

TuftServer

An instance of TuftServer is returned whenever the .createServer() method of TuftRouteMap is called.

Methods

.start()

Returns a promise that resolves with an object containing the host and port the server is listening on once the server has started.

.stop()

Returns a promise that resolves once all current connections have been closed and the server has stopped.

.setTimeout([msecs][, callback])

Sets the timeout value (a number) in milliseconds for requests to the server. The provided callback is invoked whenever the timeout value is reached.

By default, msecs is 0 (no timeout).

Throws an error if the provided callback is not a function.

.address()

If called while the server is running, returns an object containing data about the current server, such as the IP address and port number the server is listening on.

Properties

host string

The IP address or hostname that the server will listen on when it's running.

port number

The port that the server will listen on when it's running.