View Single Post
05-01-2011, 09:30 PM
#3
Immersion is offline Immersion
Status: Senior Member
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 918
iTrader: 5 / 100%
 

Immersion is on a distinguished road

  Old

So yeah, i spent part of the day playing around with node.js and i must say it really is quite neat. Only dabbled in the basics and thought it would be a good opportunity to try out mongodb. Just toyed with socket.io for the client side, and then using socket.io with mongoose to connect to a database. All it does at the moment is take messages from the user and stores it into a database. I might make the app that everyone makes, a chat app, but use mongodb for a chat history.

NodeJS Installation
https://github.com/joyent/node/wiki/Installation

I personally use a package manager to install, homebrew on my mac. But here are the other options found here https://github.com/joyent/node/wiki/...ackage-manager

Then make sure you do step 4 on the installation and install npm it will make life a lot easier when installing modules. They alll provide instructions on how to install using it.

If it is a web project then i recommend using http://socket.io/ for the server and client. It will allow the use of web sockets in modern browsers and fallback for older browsers. The site gives some code examples which should get you started but I did get confused along the way on the client side.

http://jeffkreeftmeijer.com/2010/exp...-with-node-js/
This tutorial gave me some insight into what i should be doing and roughly how to do it. Also an interesting read nonetheless on node js. My client side code can be found here: http://pastie.org/1854764 Make sure you have a copy of socket-io client, you will also need to run this page on a localhost as the url must start with http://. My server can be found here: http://pastie.org/1854769 It also features the use of mongo db.

I decided to use mongoose as from what i saw it seemed to be the nicer looking library, but there are also many others out there.
https://github.com/LearnBoost/mongoose
It also has all the documentation you will need to get started.

Thanked by 2 users:
Artashes (05-04-2011), Gaz (05-04-2011)