Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
app.get("/my-view", async (req, res) => {
res.send(render("my-view", {data: await db.getData()}))
})
function render(view, ctx = {}) {
return _.template(fs.readFileSync(`./views/${view}.html`))(ctx)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment