Home Manual Reference Source Repository
import Bq from '@becquerel/framework'
public class | source

Bq

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

routes: {}

Method Summary

Public Methods
public

route(path: string, route: Route): RouteHandler

A helper method to work with the instance's internal #routes property. Acts as a getter if the route parameter is not specified and a setter if it is. This method always returns the specified route object.

public

run(settings: Object): http.Server

Start the app server.

public

serve(incomingMessage: http.IncomingMessage, serverResponse: http.ServerResponse): undefined

The callback invoked by #run() when the server receives a client request.

Public Constructors

public constructor() source

Public Members

public routes: {} source

Public Methods

public route(path: string, route: Route): RouteHandler source

A helper method to work with the instance's internal #routes property. Acts as a getter if the route parameter is not specified and a setter if it is. This method always returns the specified route object.

Params:

NameTypeAttributeDescription
path string

The path name to get/set the route (e.g. '/resource').

route Route
  • optional

An object consisting of callback functions mapped to method keys.

Return:

RouteHandler

public run(settings: Object): http.Server source

Start the app server.

Params:

NameTypeAttributeDescription
settings Object
  • optional
  • default: {port: 8080}

The port setting defaults to the value of the BQ_RUN_DEFAULT_PORT envvar.

Return:

http.Server

The server instance that has been started.

See:

public serve(incomingMessage: http.IncomingMessage, serverResponse: http.ServerResponse): undefined source

The callback invoked by #run() when the server receives a client request.

Params:

NameTypeAttributeDescription
incomingMessage http.IncomingMessage
serverResponse http.ServerResponse

Return:

undefined

See: