Module: app

This is the application module.

Source:

(require("app"))(environment, startedCallback) → {module:app}

Starts the application and returns it.

Please note that this module is designed to be a singleton. Any subsequent loading (require("app")) will return the already started application if any.

If environment.debug === true it doesn't create any workers, thus a single process. Otherwise, it creates a worker for each CPU.

Dead workers will be replaced with new ones.

Please note that startedCallback is called for each worker.

Parameters:
Name Type Description
environment module:environment

environment to use

startedCallback function

callback to call once application is started. Receives the app instance.

Source:
Returns:

the app that is created

Type
module:app

Members

mongoose

Promisified Mongoose instance is exported so that we don't need to do it in submodules as well.

Source:

Methods

shutdown(callback)

Stops the application for current worker.

Parameters:
Name Type Description
callback function

Called when application is shut down.

Source: