const Promise = require('promise'); const sql = require('../utils/sql'); module.exports= { /** * Responsible for querying the database and displaying all * categories that the blog has in the sidebar * * @param res * @return {*|Promise} */ main: function(res) { return new Promise(function(resolve, reject) { res.write("

"); //res.write("

Categories

"); //res.write("

Categories

"); //res.write("
"); res.write("
"); res.write(" \n" + "
Categories
\n" + "
"); sql.getCategories().then(function(categories) { categories.forEach(function(cat) { //res.write(cat.name); res.write("" + cat.name + "
"); }); res.write("

"); resolve(); }) }); } };