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() { return new Promise(function(resolve, reject) { var content = "

"; content += "
"; content += " \n" + "
Categories
\n" + "
"; sql.getCategories().then(function(categories) { categories.forEach(function(cat) { content += "" + cat.name + "
"; }); content += "

"; resolve(content); }).catch(function(error) { reject(error); }); }); } };