This is a simple application that I have used to try my hand at node.js and redis. The idea came from a co-worker who asked me if I could build an application to collect the votes of our other co-workers to determine where to eat. This is the result.
There is a full tutorial at http://ejosh.co/de/2015/01/node-js-socket-io-and-redis-intermediate-tutorial-server-side/ and a screencast at https://www.youtube.com/watch?v=-_u0NjmSKgI.
I tried to keep this as simple as I could (in both programming and use). There are four things that you can do; enter an area, log in, search, and vote.
- Enter an area.
The area is set by the hash in the URL. Enter #test at the end of the URL and you will have entered the test area. Only votes inside of each area are broadcast and tallied. - Log in.
No passwords just a name. Enter a name, email, or facebook username into the textbox. Names and emails will use gravatar to create your avatar. Your facebook image is used like so - fb:username. Yes you can impersonate people, so be on your best behavior. - Search.
FourSquare is used to find restaurants around you. If the restaurant you want is not found just enter the name and search again. The x button will clear all the searched for restaurants off the map. - Vote.
Click the icon on the map and then click vote. The votes will be tallied and hopefully you will come to a decision.
The areas and votes expire after two hours. You can vote on a lunch spot and everything is cleared out by supper. This is why I am not too concerned about impersonations as everything has an expiration date.
This system uses many different open source software projects.
- http://nodejs.org/
- http://socket.io
- http://redis.io/
- http://twitter.github.com/bootstrap/
- http://gravatar.com/
- http://leaflet.cloudmade.com/
- http://facebook.github.io/react/
- http://jquery.org/
Client side Qunit tests are in the jstest folder. It is split into four modules: Josh.Cookie, Josh.Map, Josh.Socket, and React components. Coverage is done with Blanket.js. The tests currently pass in Chrome 20 and Firefox 13. IE 9 is almost there, but you will have a rough time if you use it for this.
Server side mocha test are in the test folder. The repository and Socket.IO code is covered at 90%.
If you want to fork or have pull request please make sure they all pass. If you add anything add a test for it.