/cornerstone

Primary LanguageJavaScript

REQUEST (Node ServerRequest)

request.method
request.url
request.headers
request.body
request.httpVersion

RESPONSE (Node ServerResponse)

response.status
response.headers
response.body

MESSAGE (Object)

message.headers
message.input
message.input.url
message.input.path
message.input.body
message.input.pathPrefix 
message.output
message.output.body
message.status
message.__request
message.__response

MESSAGE HANDLER (Function)

A message handler (or simply handler) is an asynchronous function that takes a request message and a response handler function and calls the response handler on response message produced.

function handleNoOp(request, handleResponse) {
  var response = {output: {body: ''}, status: 200};
  handleResponse(response);
};

A handler can also intercept another handler, in which case it takes an extra parameter of the intercepted handler.

function interceptNoOp(request, handleResponse, intercepted) {
  intercepted(request, handleResponse);
};

MESSAGE FILTER (Function)

A filter is a synchronous function that processes either the request or response message.

function filterNoOp(request) {
  return request;
};