API Docs for: 2.0.0

Class HttpServer

Class defined in: src/node-httpserver.js:40

SAGE HTTP request handlers for GET and POST

HttpServer( publicDirectory )
src/node-httpserver.js:40
Parameters:
  • publicDirectory <String>

    folder to expose to the server

Object buildHeader( )
src/node-httpserver.js:144

Build an HTTP header object


Returns: <Object>

an object containig common HTTP header values

Object detectCookies( request )
src/node-httpserver.js:58

Given a request, will attempt to detect all associated cookies.

Parameters:
  • request <Object>

    the request that came from a client


Returns: <Object>

containing the list of cookies in string format

httpGET( name, callback )
src/node-httpserver.js:570

Add a HTTP GET handler (i.e. route)

Parameters:
  • name <String>

    matching URL name (i.e. /config)

  • callback <Function>

    processing function

httpPOST( name, callback )
src/node-httpserver.js:581

Add a HTTP POST handler (i.e. route)

Parameters:
  • name <String>

    matching URL name (i.e. /upload)

  • callback <Function>

    processing function

notfound( res )
src/node-httpserver.js:82

Handle a page not found (404)

Parameters:
onreq( req, res )
src/node-httpserver.js:241

Main router and trigger the GET and POST handlers

Parameters:
redirect( res, aurl )
src/node-httpserver.js:101

Handle a HTTP redirect

Parameters: