wk 2 Backend development - Sophievanderburg/blok-tech GitHub Wiki
📚 Desk research: Templating engines
Pug | Ejs | Handlebars |
---|---|---|
// comment | <%# comment %> | {{!- - comment - -}} |
include partials/head.pug | <%- include('partials/footer') %> | {{> myPartial }} |
app.get('/', function (req, res) {res.render('index', { info })}) | ,, | ,, |
I chose ejs for several reasons:
- The syntax of ejs is the most clear to me.
- I found more articles about ejs than the other two. From this I conclude that I can find more solutions for ejs problems than for the other two engines.
- The people I work with, use ejs. So when we work together this will be easier, because we use the same engine.
Used sources
Pug
- Coffin, S. (2020, March 30). Pug.js Basics. LinkedIn. https://www.linkedin.com/pulse/pugjs-basics-sondra-coffin/
- Pug Tutorial – Complete Overview. (n.d.). CodingShala. Retrieved February 12, 2021, from https://codingshala.com/pug-tutorial/
EJS
- Asting, V. (2017, September 17). Getting started with EJS. Medium. https://medium.com/@atingenkay/getting-started-with-ejs-28fe4a693e53
- Sev, C. (2020, September 19). How To Use EJS to Template Your Node Application. DigitalOcean. https://www.digitalocean.com/community/tutorials/how-to-use-ejs-to-template-your-node-application
- How ejs template is loaded on browser? How frontend interact with backend? (n.d.). StackOverflow. Retrieved February 12, 2021, from https://stackoverflow.com/questions/53025160/how-ejs-template-is-loaded-on-browser-how-frontend-interact-with-backend
- thenewboston. (2015, April 5). Node.js Tutorial for Beginners - 19 - EJS [Video]. YouTube. https://www.youtube.com/watch?v=RgAseumFyg8
Handlebars
- Handlebars. (n.d.). Installation Handlebars. Retrieved February 12, 2021, from https://handlebarsjs.com/installation/
- How to Setup Handlebars View Engine in Node.js ? (2020, April 27). Geeksforgeeks. https://www.geeksforgeeks.org/how-to-setup-handlebars-view-engine-in-node-js/