How to pass variables to res.render() in Node.js

I was trying to figure out how to render a view inside a view, as I was stuck with this issue.

Horrible Effects of Misplaced Extensions ;)


I was using Node.js platform with ejs template engine.

My index.ejs file has an included header.ejs file.
Everything works well except that I can't pass values to the variable status in header.ejs.

Here is my abstract code...

index.ejs



header.ejs



app.js



The most funniest solution ever!


The solution is as easy as this.
Just remove .ejs extension from the include command.
I spent at least an entire night to figure it out.

Popular posts from this blog

Talky Messenger Documentation & Setup