const utils = require('../utils/utils.js');
var Promise = require('promise');
var markdown = require( "markdown" ).markdown;
module.exports=
{
/**
* renderPost() displays a single blog post in it's entirety
*
* @param res result sent to user
* @param post sql data about the blog post
* @return {*|Promise}
*/
renderPost: function(res, post)
{
return new Promise(function (resolve, reject)
{
res.write("
");
//image
res.write("
");
//title
res.write("
" + post.name + "
");
//date
res.write("" + post.date + "
");
res.write("");
res.write("
");
var pathName = "entries/" + post.url + ".md";
try
{
res.write(markdown.toHTML(utils.getFileContents(pathName)));
}
catch(ex)
{
console.log(ex);
//utils.include(res, "includes/404.html");
}
res.write("
");
resolve()
});
}
};
/*
TITLE HEADING
Title description, Date
content
*/