I'm getting a pretty dumb error on a extremely simple express app. I am using jade as the view engine, I'm saying this just in case it is related to the problem.
I'm trying to check if a variable is defined in order to render one thing or another, but simply checking for that variable triggers a "variable is not defined" Error. This is not the behaviour I'd expect, so I'm wondering if I'm doing something wrong. This is the view code I'm using:
h1= title
- if (user)
p Welcome to #{title}, #{user.username}
- else
p Welcome to #{title}
What is the right way to do this? There must be a way to check for variables on the views. :-/
EDIT: Forgot to say on what line the error is triggered, it is triggered on the second line "- if (user)".