[Fixed]-How to create template tags (django) in express framework

1👍

The express framework has got absolutely nothing to do with the template package that you are free to select for using with node.js. There are many choices for that which is beyond the scope of this question, but for example, for jade and ejs which are some common ones there is no such thing as tags similar to Django, but I am sure thre may be others.

Having said that, there are always alternative ways to achieve what you want and things with js are certainly different from the more opinionated approach of Django (which I very much appreciate btw). Therefore, you can either define a js function in the template itself (see this and this), or even define it in the context that is passed with the express’ res.render function.

👤Wtower

0👍

Sure, check this awesome template engine – Swig . Also, if you want to taste something different, but with the same flavor check Handlebars engine as well!

Leave a comment