Subscribe to our list to receive the latest updates on Node on Fire

Class: App

App

new App(name, settings)

Initialize a new App for both the client- and server-context. A new app is usually created via Firestarter#app.

In the client-context, this creates an angular.Module with name and requires from settings.modules. This instance also acts as a proxy to the angular.Module. This means that you can invoke directive, controller or any of the angular.Module methods.

For a complete list, angular's Module documentation at https://docs.angularjs.org/api/ng/type/angular.Module.

Parameters:
Name Type Description
name String

Name of the app.

settings Dictionary
Properties
Name Type Description
type String

The type of the app, either angular or ractive.

modules Array

List of requires passed to angular.Module. These modules are also automatically bundled in browserify if they are available in node_modules.

require Array

List of additional files to bundle in browserify in the build stage.

isMaster Boolean

Whether this app is the master. A master app is responsible for any shared models and other dependencies.

Methods

_start()

Starts the app by setting up all modules, invoking all configure functions, starting the HTTP server and binding to the value of PORT defined in the environmental table.

This method should not be be invoked multiple times (even after calling App#stop).

Returns:
Type
Promise

addModule(moduleConstructor)

Adds a new module to the app.

Parameters:
Name Type Description
moduleConstructor Constructor

The module constructor which gets invoked with 1 param: this app instance.

Returns:

The app instance-so this method is chainable.

Type
App

configure(configureFunction)

This method has been deprecated. Please use StageMethods#run instead.

Parameters:
Name Type Description
configureFunction function

The function to call during run phase.

removeModule()

Removes a module.

app.removeModule(app.webSockets);

start()

Starts the app.

This method is deprecated. Please use fire#start() instead.

Deprecated:
  • Yes

stop()

Stops the app. This also invokes the stop method on all modules.

Returns:

Resolves when closing of the server finishes, or rejects when an error occurs.

Type
Promise

Do you have any questions or comments on this page? Start a discussion below.

comments powered by Disqus
Subscribe to our list to receive the latest updates on Node on Fire