Application Class
Defined in:
Module: application
lib/application.js:16
Creates an instance of Application
var util = require('util');
var ferrum = require('ferrum');
var options = {
routes: {
'^/$': MainHandler
}
};
function MainHandler () {
ferrum.RequestHandler.call(this);
this.get = function () {
this.write("Hello world!");
};
}
util.inherits(MainHandler, ferrum.RequestHandler);
ferrum.Application(options).run();
Constructor
Application
(
Object
chainable
-
options
Parameters:
-
optionsObjectApplication options
-
[host]String optionalA domain name or IP address of the server to handle the requests. 'localhost' by default.
-
[port]String optionalPort of the server to be listened. '8888' by default.
-
[routes]Object optionalDictionary of application routes. Where 'keys' are route paths and 'values' are their handlers. By default it includes only route for static files.
-
[debugMode]Boolean optionalDefines logger level and other staff needed for debugging. 'false' by default.
-
[logger]Object optional...
-
[loggerTransports]Array optionalArray of extra logger transports. You can add other transports which supported by winston. List of existing transport you can find here - https://github.com/flatiron/winston#working-with-transports. By default
ferrumincludesFileandConsoletransports.
-
Returns:
Object:
Application instance.
The Ferrum API