Private
Current route ( Client only )
Private
Initial / default route
Private
Reused regex object
Private
Routing listeners
Public method method
Determines which HTTP method to use
Parameters:
Returns a [type]
(HTTP method to utilize)
Public method del
Deletes a route
Parameters:
name must be a String.
(Route name)
verb must be a String.
(HTTP method)
Returns a Mixed
(True or undefined)
Public method hash
Getter / setter for the hashbang
Parameters:
Returns a String
(Current route)
Public method hostname
Creates a hostname entry in the routes table
Parameters:
Returns an Object
(Routes for hostname)
Public method init
Initializes the routing by loading the initial OR the first route registered
Returns an Undefined
(undefined)
Public method list
Lists all routes
Parameters:
Returns a Mixed
(Hash of routes if host
not specified, else an Array of routes for a method)
Public method load
Loads the hash into the view
Parameters:
name must be a String.
(Route to load)
req must be a String.
([Optional] HTTP request ( node ))
res must be an Object.
([Optional] HTTP response ( node ))
host must be a String.
([Optional] Hostname to query)
Returns a Mixed
(True or undefined)
Not a GET, but assuming the route is smart enough to strip the entity body
Public, private, local scope
Private method crawl
Crawls the hostnames, sets active
& path
Parameters:
host must be a String.
(Hostname)
verb must be a String.
(HTTP method)
name must be a String.
(Route)
Returns an Undefined
(undefined)
Private method find
Finds a match, sets active
& path
Parameters:
pattern must be a String.
(Route)
method must be a String.
(HTTP method)
arg must be a String.
(URL)
Returns an Undefined
(undefined)
Public method reset
Resets the routes
Returns an Undefined
(undefined)
Public method server
Creates a Server with URI routing
Parameters:
arg must be an Object.
(Server options)
fn must be a Function.
(Error handler)
ssl must be a Boolean.
(Determines if HTTPS server is created)
Returns an Object
(Server)
Private method handler
Request handler
Parameters:
req must be an Object.
(HTTP(S) Request Object)
res must be an Object.
(HTTP(S) Response Object)
Returns an Undefined
(undefined)
Private method err
Error handler
Parameters:
Returns an Undefined
(undefined)
Enabling routing, in case it's not explicitly enabled prior to route.server()
Server parameters
Creating server
For proxy behavior
For proxy behavior
Public method set
Sets a route for a URI
Parameters:
name must be a String.
(Regex pattern for the route)
fn must be a Function.
(Route listener)
verb must be a String.
(HTTP method the route is for ( default is GET ))
Returns a Mixed
(True or undefined)
URI routing via hashtag Client side routes will be in routes.all