Thomson Thomson - 9 months ago 40
Node.js Question

Node js unable to connect using

Hi I am very new to Node JS and I am trying to learn through Sams teach yourself in 24 hours. I have installed express globally and was following exactly book says.Installed express globally.

express jade_conditions

installed dependencies

cd jade_conditions && npm install

and ran

node app.js

and then asked to open browser with node
and here is the problem because I am not able to open any site. It says Unable to connect. Am I missing anything. Because I dont understand where is this coming from. Can anyone help me how to see those jade.index file from the view folder on the browser ?
Thanks in advance.


If you creates an app with express-generator then it won't be work with node app.js since listen configuration has been done in bin/www folder and it will run with start command

Do this

> npm start

And open your above link on broswer

And if you want to use node app.js then listen it on a particular port in your app.js file like this

> app.listen(3000); 

And use node app.js and it will work

For reference check it in details here: