Created
March 23, 2018 14:02
-
-
Save odino/7ce4dc3bb77d6282b2f2aaf1050c29e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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