Class: Server

Server()

Serves the specs and supporting files via HTTP.

Constructor

new Server()

Methods

hostname() → {string}

Gets the hostname that the server is listening on. The server must be started before this method is called.

Returns:

The hostname (localhost if not specified)

Type
string

port() → {number}

Gets the port that the server is listening on. The server must be started before this method is called.

Returns:

The port number

Type
number

scheme() → {string}

Gets the URL scheme that the server is listening on. The server must be started before this method is called.

Returns:

The URL scheme ('http' or 'https')

Type
string

start(options) → {Promise.<undefined>}

Starts the server.

Parameters:
Name Type Description
options ServerStartOptions
Returns:

A promise that resolves upon successful start.

Type
Promise.<undefined>

stop() → {Promise.<undefined>}

Stops the server.

Returns:
Type
Promise.<undefined>

Server(options)

new Server(options)

Parameters:
Name Type Description
options ServerCtorOptions

Methods

hostname() → {string}

Gets the hostname that the server is listening on. The server must be started before this method is called.

Returns:

The hostname (localhost if not specified)

Type
string

port() → {number}

Gets the port that the server is listening on. The server must be started before this method is called.

Returns:

The port number

Type
number

scheme() → {string}

Gets the URL scheme that the server is listening on. The server must be started before this method is called.

Returns:

The URL scheme ('http' or 'https')

Type
string

start(options) → {Promise.<undefined>}

Starts the server.

Parameters:
Name Type Description
options ServerStartOptions
Returns:

A promise that resolves upon successful start.

Type
Promise.<undefined>

stop() → {Promise.<undefined>}

Stops the server.

Returns:
Type
Promise.<undefined>