This is an introducution on building a functional Node.js app with Ember.js, socket.io, passport, deploying on Heroku. I am using this for my personal projects.
-
Create a brunch project.
$-> brunch new <name of your project> --skeleton git://github.com/octapus/Brunch-Ember-Socket.io
-
Get dependencies for the project
$-> npm install
It will build itself after the install.
-
Run the server and watch the project
$-> brunch watch -server
-
You can then check out your browser
http://localhost:3333
You will get something like this in return on the command prompt
info - socket.io started --- app listening on http://0.0.0.0:3333 10 Apr 01:05:22 - info: compiled in 355ms debug - served static content /socket.io.js debug - client authorized info - handshake authorized xuGzgI4UBwYG-hzPVX18 debug - setting request GET /socket.io/1/websocket/xuGzgI4UBwYG-hzPVX18 debug - set heartbeat interval for client xuGzgI4UBwYG-hzPVX18 debug - client authorized for debug - websocket writing 1::
This means you have a socket.io connection with your client.
-
You can deploy this to heroku by this point. Make sure you have heroku installed or follow the instructions here.
The best thing is to test your app locally before deploying to heroku:
$-> brunch build $-> foreman start
-
By this point, you should have a remote heroku repository added to your git. Commit your changes to your git master. Then push this to your heroku remote repository.
$-> git push heroku master
-
Open your app up
$-> heroku open
Brunch - Application assembler for HTML5 apps.
CoffeeScript - JavaScript annotations.
Express - Web app framework.
Socket.Io - WebSocket for realtime apps.
Passport - Authentication for Node.js.
Please follow the Wiki page for more detailed walk through.