Allow packages to hook in before app html serving. Cherry picked from auth branch.

This commit is contained in:
Avital Oliver
2012-06-11 15:45:26 -07:00
committed by Nick Martin
parent ac06cbb4b6
commit a2d5bfa6db

View File

@@ -80,21 +80,6 @@ var run = function () {
app_html = runtime_config(app_html);
app.use(function (req, res) {
// prevent favicon.ico and robots.txt from returning app_html
if (_.indexOf(['/favicon.ico', '/robots.txt'], req.url) !== -1) {
res.writeHead(404);
res.end();
return;
}
res.writeHead(200, {'Content-Type': 'text/html'});
if (supported_browser(req.headers['user-agent']))
res.write(app_html);
else
res.write(unsupported_html);
res.end();
});
// read bundle config file
var info_raw =
@@ -127,6 +112,22 @@ var run = function () {
require('vm').runInThisContext(code, filename, true);
});
app.use(function (req, res) {
// prevent favicon.ico and robots.txt from returning app_html
if (_.indexOf(['/favicon.ico', '/robots.txt'], req.url) !== -1) {
res.writeHead(404);
res.end();
return;
}
res.writeHead(200, {'Content-Type': 'text/html'});
if (supported_browser(req.headers['user-agent']))
res.write(app_html);
else
res.write(unsupported_html);
res.end();
});
// run the user startup hooks.
_.each(__meteor_bootstrap__.startup_hooks, function (x) { x(); });