app.js
* @module greppy/app/worker/middleware/app
* @author Hermann Mayer <hermann.mayer92@gmail.com>
var _ = require('lodash-node');
* @param {Object} baseApp - Greppy base application instance
var AppMiddleware = function(baseApp)
* Append the app middleware to the given application stack.
* @param {Object} app - Application to configure
* @param {function} callback - Function to call on finish
AppMiddleware.prototype.configure = function(app, callback)
app.use(function greppyApp(req, res, next) {
// Add app object to the response locals
link : self.baseApp.link.bind(self.baseApp),
linkContext : self.baseApp.linkContext.bind(self.baseApp),
// Add linking functionality to the application
res.link = self.baseApp.link.bind(self.baseApp);
res.linkContext = self.baseApp.linkContext.bind(self.baseApp);