Splitted the node server in modules

This commit is contained in:
Gaël Métais
2014-08-07 19:26:58 +02:00
parent 9b6b0f39f0
commit 7fcdf2aaa2
17 changed files with 407 additions and 250 deletions
+23
View File
@@ -0,0 +1,23 @@
/**
* Yellow Lab Tools home page controller
*/
var async = require('async');
var fs = require ('fs');
var indexController = function(req, res) {
'use strict';
async.parallel({
htmlTemplate: function(callback) {
fs.readFile('./app/node_views/index.html', {encoding: 'utf8'}, callback);
}
}, function(err, results) {
res.setHeader('Content-Type', 'text/html');
res.send(results.htmlTemplate);
});
};
module.exports = indexController;