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

Class: Bridge


new Bridge(app)

The Bridge module compiles Mustache templates to client-side JavaScript libraries in the build phase. All JavaScript is concatenated in a single fire.js file.

Modules can extend Bridge's functionality by including a generator method which returns a Generator instance. For example:

function MyModule(app) { = app;

MyModule.prototype.generator = function() {
    return new, 'templates','type'), 'my-module.js'), {
        // Module data here.
Name Type Description
app App

The app which loads this module.



Exposes the Generator constructor. This is useful for modules implementing the generator method.

<inner> generateFireControllers

Generates all controller services and all local routes for the angular-route module.

<inner> generateFireInit

Generates the initial angular.Module and all the methods like angular.directive(...).

<inner> generateLocalControllers

Generates the client-side angular controllers from the controllers' constructor's.

function TestController($scope) {
    $scope.test = function() {

Roughly generates:

app.controller('TestController', ['$scope', function($scope) {
    $scope.test = function() {

<inner> generateModels

Generates a client-side library to manage your models with a 1-to-1 API as the models api on the server-context.

For more information on the API itself, see the Models module.



Generates the client-side fire.js by executing all generators local in ./generators.

In addition, every module may provide a generator if it implements a generator method. Bridge loops over every module and executes it's generator method (if it exists). The generator method should return an instance of Generator.

Please note: this method will close the write stream by calling fs.WriteStream#end once it succeeds.

Name Type Description
writeStream fs.WriteStream

An opened stream to write to.


Resolves when succeeded. Rejects when fails.


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