indexController.js 622 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Yellow Lab Tools home page controller
  3. */
  4. var async = require('async');
  5. var fs = require ('fs');
  6. var indexController = function(req, res, googleAnalyticsId) {
  7. 'use strict';
  8. async.parallel({
  9. htmlTemplate: function(callback) {
  10. fs.readFile('./app/node_views/index.html', {encoding: 'utf8'}, callback);
  11. }
  12. }, function(err, results) {
  13. var html = results.htmlTemplate;
  14. html = html.replace('%%GA_ID%%', googleAnalyticsId);
  15. res.setHeader('Content-Type', 'text/html');
  16. res.send(html);
  17. });
  18. };
  19. module.exports = indexController;