I am using node.js and ejs for my template, and I included the header.html which contain all the libraries and style files, for all my html files. The problem that I have is that it reloads all the html, css, and js when I switch between html files (e.g: home.html and about.html).
How can I cache the js and css files and avoid reloading them when I render?
Is there a easy and convenient way (plugins) to swap out the body content and not reload header.html every time for every html files?
HTML files (home.html and about.html)
<% include header.html %>
<body>
<% include navbar.html %>
<% include menu.html %>
</body>
Route files for home.html and about.html
router.get('/', function(req, res) {
req.getConnection(function (err, conn) {
res.render('home', {data: rows});
});
});
I need to perform alot of querys in the back-end, and needs to return the data to the front-end.