Node.js: Creating a new project with Express framework 
// install express globally
$npm install -g express-generator

// create a new project using handlebars for views
$express -hbs "node-chat"

// cd into "node-chat" and execute:
$npm install

// add suport for socket.io
$npm install socket.io --save


// output versions
[acool@localhost node-chat]$ node --version
v0.10.33
[acool@localhost node-chat]$ npm --version
1.3.6
[acool@localhost node-chat]$ express --version
4.11.1

// make sure daemon (dev only) is installed and run:
// (I think you can also do npm start or node bin/www)
[acool@localhost node-chat]$ nodemon bin/www

// finally go to browser and type http://localhost:3000
// ...socket.io sample to come.


[ view entry ] ( 1381 views )   |  print article

| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |


2024 By Angel Cool