Slide 50
Slide 50 text
FastBootServer.prototype.middleware = function() {
return function(req, res, next) {
var path = req.url;
var server = this;
debug("handling url; url=%s", path);
var startTime = Date.now();
this.app.visit(path, { request: req, response: res })
.then(success, failure)
.finally(function() {
debug("finished handling; url=%s", path);
});
function success(result) {
server.handleSuccess(res, path, result, startTime);
}
function failure(error) {
server.handleFailure(res, path, error, startTime);
}
}.bind(this);
};
ember-fastboot-server/lib/server.js