Class: Router

Router()

Router contains all route definitions for the Server to use.

Constructor

new Router()

Create a Router instance.
Source:

Methods

delete(path, callback)

Register a callback for a DELETE route. Callback with receive params (requestData, respondWith) requestData is an object with various request data like "body" respondWith is a function that takes (statusCode = 200, responseData = '', contentType = 'text/json')
Parameters:
Name Type Description
path string The path
callback function The callback
Source:

get(path, callback)

Register a callback for a GET route. Callback with receive params (requestData, respondWith) requestData is an object with various request data like "body" respondWith is a function that takes (statusCode = 200, responseData = '', contentType = 'text/json')
Parameters:
Name Type Description
path string The path
callback function The callback
Source:

post(path, callback)

Register a callback for a POST route. Callback with receive params (requestData, respondWith) requestData is an object with various request data like "body" respondWith is a function that takes (statusCode = 200, responseData = '', contentType = 'text/json')
Parameters:
Name Type Description
path string The path
callback function The callback
Source:

put(path, callback)

Register a callback for a PUT route. Callback with receive params (requestData, respondWith) requestData is an object with various request data like "body" respondWith is a function that takes (statusCode = 200, responseData = '', contentType = 'text/json')
Parameters:
Name Type Description
path string The path
callback function The callback
Source:

route(method, path) → {function}

Returns the callback for the route defined by the method and path.
Parameters:
Name Type Description
method string The http method used (GET, POST, etc)
path string The path being called
Source:
Returns:
The function registered for the desired route
Type
function