Skip to content

Instantly share code, notes, and snippets.

@odino
Created March 23, 2018 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save odino/7ce4dc3bb77d6282b2f2aaf1050c29e3 to your computer and use it in GitHub Desktop.
Save odino/7ce4dc3bb77d6282b2f2aaf1050c29e3 to your computer and use it in GitHub Desktop.
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