Home Reference Source Repository
import {RestTestServer} from 'test-rest/src/components/server.js'
public class | source

RestTestServer

This component is responsible for configuring and controlling the test-rest server.

Constructor Summary

Public Constructor
public

constructor(serverConfig: ServerConfig, hapiConfig: Object)

Creates a new instance of RestTestServer.

Member Summary

Public Members
public get

Returns all the endpoints configured for the server.

public get

Returns all endpoint and nested endpoints generated routes as an array.

Method Summary

Public Methods
public

restart(callback: Function)

Restarts the server.

public

start(callback: Function)

Starts the server.

public

stop(callback: Function)

Stops the server.

Public Constructors

public constructor(serverConfig: ServerConfig, hapiConfig: Object) source

Creates a new instance of RestTestServer.

Params:

NameTypeAttributeDescription
serverConfig ServerConfig

The server configuration object.

hapiConfig Object
  • optional

Optional configuration for the underlying Hapi-server. See http://hapijs.com/api#new-serveroptions for more information.

Public Members

public get endpoints: Array<Endpoint> source

Returns all the endpoints configured for the server.

public get routes: Array<T> source

Returns all endpoint and nested endpoints generated routes as an array. Note that to ensure routing the array returned is from bottom-up.

Public Methods

public restart(callback: Function) source

Restarts the server.

Params:

NameTypeAttributeDescription
callback Function
  • optional

An optional callback that will be executed after a successful restart.

public start(callback: Function) source

Starts the server.

Params:

NameTypeAttributeDescription
callback Function
  • optional

An optional callback that will be executed after a successful startup.

public stop(callback: Function) source

Stops the server.

Params:

NameTypeAttributeDescription
callback Function
  • optional

An optional callback that will be executed after a successful halt.