ServerInitializer Class
Creates and initializes the HTTP server
Constructor
ServerInitializer
(
-
[pb]
Parameters:
-
[pb]
Object optionalThe PB object
Item Index
Methods
_init
(
private
-
context
-
cb
Parameters:
-
context
Object-
log
Logger -
config
ObjectThe PB config object
-
onRequest
FunctionTakes 2 parameters: req, res
-
[onHandOffRequest]
Function optionalTakes 2 parameters: req, res. It is required if starting with SSL enabled
-
-
cb
Function
getServer
(
-
context
Parameters:
-
context
Object-
onRequest
FunctionTakes 2 parameters: req, res return {HttpServer}
-
getSslServer
(
HttpsServer
-
context
Parameters:
-
context
Object-
config
ObjectThe PB config object
-
onRequest
ObjectTakes 2 parameters: req, res
-
Returns:
HttpsServer:
getSslServerOptions
(
Object
-
config
Parameters:
-
config
Object-
server
Object-
ssl
Object -
ssl.key
String -
ssl.cert
String -
ssl.chain
String
-
-
Returns:
Object:
init
(
-
context
-
cb
Initializes the server. Depending on the configuration will start an HTTP server and/or an HTTPs server.
Parameters:
-
context
Object-
log
Logger -
config
ObjectThe PB config object
-
onRequest
FunctionTakes 2 parameters: req, res
-
[onHandOffRequest]
Function optionalTakes 2 parameters: req, res. It is required if starting with SSL enabled
-
-
cb
Function
initHttp
(
-
context
-
cb
Parameters:
-
context
Object-
log
Logger -
config
ObjectThe PB config object
-
onRequest
FunctionTakes 2 parameters: req, res
-
-
cb
Function
initHttps
(
-
context
-
cb
Parameters:
-
context
Object-
log
Logger -
config
ObjectThe PB config object
-
onRequest
FunctionTakes 2 parameters: req, res
-
onHandOffRequest
FunctionTakes 2 parameters: req, res
-
-
cb
Function
startServer
(
-
server
-
port
-
ip
-
cb
Does a simple start on a server object by binding to the specified IP address and port.
Parameters:
-
server
HttpServer | HttpsServer -
port
Integer -
ip
String -
cb
Function