Barefoot.Start.Server

This start mixin supplies a server specific start function to get the application up and running on the node.js server backend.

Summary
Barefoot.Start.ServerThis start mixin supplies a server specific start function to get the application up and running on the node.js server backend.
Private Functions
getServerOnlyFilesReturns an array with absolute paths to the files contained in the server sub folder.
prepareBrowserifyAdds the Browserify middleware the the given express.js app.
Functions
startOn start on the server, this function creates an APIAdapter if apiRoutes are present in the startOptions.

Private Functions

getServerOnlyFiles

Returns an array with absolute paths to the files contained in the server sub folder.

Returns

(Array)

prepareBrowserify

Adds the Browserify middleware the the given express.js app.

Parameters

(Object) appExpress.JS app
(Object) optionsSet of options

Functions

start

function start(Router,
APIAdapter,
startOptions)

On start on the server, this function creates an APIAdapter if apiRoutes are present in the startOptions.  Further the actual Barefoot.Router is created an started using Barefoot.Router.Server.start.

Before doing all this, startOptions is checked if an Express.JS app is present (if not, an error gets thrown which will stop the start process).

Parameters

(Barefoot.Router) RouterA Barefoot.Router object.  Important: This is is not an instance of the router, it is the “plain” object which can be used for running “new Router(...)”.
(Object) startOptionsThis object literal is passed to the router when initializing it.
function start(Router,
APIAdapter,
startOptions)
On start on the server, this function creates an APIAdapter if apiRoutes are present in the startOptions.
When building a fancy JavaScript based client you’ll probably have a straight forward REST API in the backend.
The barefoot router extends the default backbone router by applying environment specific mixins to it
function start()
Calls the passed starter function, buffered in preInitialize.
Close