I am having a problem with my show page. It is supposed to show a specific post in more detail when you click on it in the index page. I get no errors in the browser or the "mysql" terminal and the show page renders properly, with the HTML running smoothly, but there are three empty H1's where there should be the details about the post.
I am using sequelize as my ORM and ejs as a template engine. (Also node, express and mysql for the database) All this is run locally off my computer.
Here is the code for my app.get request:
app.get("/posts/:id", function(req, res){
Post.findAll({
where: {
id: req.params.id
}
}).then(function(foundPost){
var renderPost = foundPost;
res.render("show", {post: renderPost});
});
});
And the code for my show.ejs file:
<% include ./partials/header %>
<h1><%= post.author%></h1>
<h1><%= post.body%></h1>
<h1><%= post.title%></h1>
hi
<% include ./partials/footer %>
via sespler
No comments:
Post a Comment