Last active
October 4, 2018 06:15
-
-
Save ganeshkbhat/d3593030a48e2f7f083891229fd717ba to your computer and use it in GitHub Desktop.
ExpressJS Series: Addig a Template engine and usage
This file contains hidden or 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
/* OTHER CODES */ | |
// Set TEMPLATING Engine views folder | |
app.set('views', './views'); | |
// Setting Pug as Templating engine | |
app.set('view engine', 'pug'); | |
// Sends response from the template views/index | |
// Data of object {status:'running'} is provided/injected to the template and ... | |
// ... can be accessed there | |
app.get("/template", function(req, res) { | |
res.status(200) | |
.render('index', {title: 'My Pug page', status:'running'}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment