const Promise = require('promise'); const sql = require('../utils/sql'); module.exports= { /** Renders the the recent post sidebar. * * @returns {*|Promise} */ main: function() { return new Promise(function(resolve, reject) { console.log("recent page"); var content = "
"; content +="
"; content +=" \n" + "
Recent Posts
\n" + "
"; sql.getRecentPosts().then(function(posts) { posts.forEach(function(p) { var url = '/' + p.category + '/' + p.url; content += "" + p.name + "
"; }); content +="
"; resolve(content); }).catch(function(error) { reject(error); }) }); } };