I am making an application using node.js with express.js, and instead of using JADE, I am using EJS (Embedded Javascript). When I send(response) information to be plugged into my template I usually send as JSON file, but sometimes I want the JSON file have big chunk of HTML code. This is what I have:
- JSON File
- index.js (to send response)
- blogPost.html
This is what I need:
- Get blog post into the JSON file
- Send it through index.js and make the server send the template with the HTML code...
I need:
{
"title": "Test blog post",
"paragraph": fs.readFileSync(blogPost.html)
}
replace the fs.readFileSync() with whatever I would use in JSON to read a file.