stormpath/stormpath-passport-express-sample

User undefined error after converting .jade flawlessly to .ejs

Opened this issue · 2 comments

Converted all the views to .ejs and everything except the login page works. I found out that error comes from user being undefined if logged out and if I remove this navbar snippet that mentions user. Everything works. However the jade version is completely identical.

<ul class="nav nav-pills pull-right">
          <li>
            <a href="/")>Home</a>
            </li>
            <%
          if (user) { 
           %>
            <li>
              <a href="/dashboard">Dashboard</a>
                </li>
            <li>
              <a href="/logout">Log out</a>
            </li>
            <% } else { %>
                <li>
              <a href="/login">Login</a>
                </li>
            <% } %>
        </ul>

Do you have to pass any options to express to configure it to use EJS instead of Jade?

@robertjd , first you need to

npm install ejs --save

and then change your app.js view engine from jade to ejs

app.set('view engine', 'ejs');