RingoJS

Module ringo/httpserver/index

Functions

Properties



build (options)

Parameters

null options

destroy ()

Daemon life cycle function invoked by init script. Frees any resources occupied by the Server instance. If the application exports a function called destroy, it will be invoked with the server as argument.

Returns

Server

the Server instance.


init (path)

Daemon life cycle function invoked by init script. Creates a new Server with the application at appPath. If the application exports a function called init, it will be invoked with the new server as argument.

Parameters

String path

Optional application file name or module id. If undefined, the first command line argument will be used as application. If there are no command line arguments, module main in the current working directory is used.

Returns

Server

the Server instance.


main (path)

Main function to start an HTTP server from the command line. It automatically adds a shutdown hook which will stop and destroy the server at the JVM termination.

Example

// starts the current module via module.id as web application
require("ringo/httpserver").main(module.id);

// starts the module "./app/actions" as web application
require("ringo/httpserver").main(module.resolve('./app/actions'));

Parameters

String path

optional application file name or module id.

Returns

Server

the Server instance.


start ()

Daemon life cycle function invoked by init script. Starts the Server created by init(). If the application exports a function called start, it will be invoked with the server as argument immediately after it has started.

Returns

Server

the Server instance.


stop ()

Daemon life cycle function invoked by init script. Stops the Server started by start().

Returns

Server

the Server instance. If the application exports a function called stop, it will be invoked with the server as argument immediately before it is stopped.