MarcoS MarcoS - 3 months ago 9
Node.js Question

Simple realtime web app to be used as a 'voting terminal'

I am asked to project a web solution to allow vote casting in public assemblies.

The solution shall be written with

on the server, and
, possibly using
on the client (since javascript is the language I know best, today :-).

The app shall run on mobile devices, and will be quite simple: it shall handle some sort of authentication, to identify the owner of the device (the 'user'), and shall show a form with two buttons (

The button press shall be sent to a central server (on the LAN).

The server shall collect and store the votes from the users, and shall choose when to enable the buttons (voting session opened), and when to disable them (voting session closed).

Trying to be clearer, the app shall replace current devices, which look like this one:

vote terminal

It's not so clear from the picture, but the device has two buttons, one for "Yes" vote, and one for "No" (there are more buttons, but their use is irrilevant, here).

Initially the app will handle only the vote casting (not the audio).

I'm totally new to web realtime programming, so I'm in doubt about which software stack of libraries to adopt for the project.

Googling around, I see could be a good solution, but I prefer asking the community, to try to find the most suited solution for the job.

So the final question: do you know of any open-source project, tutorial, bolg post, anything I could study to start designing the app I tried to describe?

Any solution, observation, opinion, real-life experience would be welcome, too...

Answer is used essentially when you need something in realtime. The tradition RESTful APIs are a better/proven method.

To get started I would suggest reading up on the MEAN stack (also allows you to use the MongoDB database), A couple of tutorials should be a good starting point : is a good resource to scaffold out your project. Slush is a generator that uses GULP as compared to yeoman generators which are only just beginning to implement gulp as its task-runner (currently uses grunt as the default task runner). Yeoman still doesnt have a great generator for the MEAN stack. If however you plan to exclude the database a good starting point would be to just use express on the backend and angularjs as the front end. To do this you can scaffold out a express project using generator-express ( and once express is setup you can add angular to it using

The directory would look something like this :

---*client side libs*
--- www /* npm start to start the server */
-routes/ /* for all your express routing */

For authentication you could use the scaffolded out CRUD model. If using for all the client server communication this is a good resource -