Note that there are some explanatory texts on larger screens.

plurals
  1. POExpress.js, Node.js Jade - Following the expressjs.com tutorials, and getting errors
    text
    copied!<p>Well I'm trying to get into Node.js / Express.js - however I've been having a few issue going through the screencast, the first issue, now resolved, was pretty obvious when it was spotted (<a href="https://stackoverflow.com/questions/5843850/express-js-node-js-jade-vim">Express.js, Node.js Jade vim</a>).</p> <p>However, I'm now getting the following errors:</p> <pre> Express 500 SyntaxError: Unexpected identifier * at Object.Function (unknown source) * at Object.compile (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/jade.js:230:10) * at ServerResponse._render (/usr/local/lib/node/.npm/express/2.3.2/package/lib/view.js:368:22) * at ServerResponse.render (/usr/local/lib/node/.npm/express/2.3.2/package/lib/view.js:234:17) * at Object. (/home/duncan/helloExpress/app.js:46:7) * at nextMiddleware (/usr/local/lib/node/.npm/express/2.3.2/package/lib/router/index.js:139:34) * at param (/usr/local/lib/node/.npm/express/2.3.2/package/lib/router/index.js:147:16) * at pass (/usr/local/lib/node/.npm/express/2.3.2/package/lib/router/index.js:155:10) * at Object.router [as handle] (/usr/local/lib/node/.npm/express/2.3.2/package/lib/router/index.js:161:6) * at next (/usr/local/lib/node/.npm/connect/1.4.0/package/lib/http.js:204:15) </pre> <p>My app.js code is as follows: Declare the users array of object</p> <pre> var users = [ { name: 'Duncan', email: 'duncan@email.com'}, { name: 'Bob', email: 'bob@email.com'} ]; </pre> <p>and... the bit that calls and renders the new users.jade</p> <pre> app.get('/users', function(req, res){ res.render('users', { users: users }); }); </pre> <p>I don't know if I'm just being blind today, but I would really like to get this example working. </p> <p>NB. app.js 46:7 is the 'res.render' char 7 is the . between res and render. - from the error message. </p> <p>The users.jade file is as follows:</p> <pre>h1 Users ul#users - each user in users li= user.name </pre> <p>If I get rid of the: user in users and li= user.name</p> <p>it renders the page, as soon as I add them, it gives me the above error message, and says there is something wrong with res.render('users' - on the dot (46:7).</p> <p>PS. I'm following the second tutorial on here: <a href="http://expressjs.com/screencasts.html" rel="nofollow noreferrer">http://expressjs.com/screencasts.html</a></p> <p>My indentation:</p> <pre> [indent] - [indent] each user in users [indent][indent] li= [indent] user.name </pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload