Skip to content

Commit

Permalink
Allow packages to hook in before app html serving. Cherry picked from…
Browse files Browse the repository at this point in the history
… auth branch.
  • Loading branch information
avital authored and n1mmy committed Jul 21, 2012
1 parent ac06cbb commit a2d5bfa
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions app/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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(); });

Expand Down

0 comments on commit a2d5bfa

Please sign in to comment.