I'm starting to use nodejs and socket.io...
Is it pure javascript or do i have to learn a framework like JQuery or MOntools ?
Thank you!
node.js is pure javascript.
Yes you do need to learn node.js because its your server-side IO library. And no you do not need to learn jQuery or MooTools for server-side development.
Within the node.js community there is a strong emphasis on using 3rd party libraries to achieve what you want. There are currently no frameworks set up for node.
A couple of libraries worth learning are
Express is a lightweight MVC library that builds ontop of connect. This gives you access to a Routing library and a view engine. When used in combination with EJS or Jade it will allow you to set up your node.js code to handle incoming routes individually and rendering data from templates. I would also recommend looking at express-controllers which is a great way to handle REST style routing of your urls.
now is an abstraction on-top of socket.io. It offers a "shared" namespace between client and server. This make RPC trivial. Simply declare a function as a property of now on the server and call it from the client. Now handles all the socket.io communication for you.
Cradle is an abstraction that allows you to interact with couchdb. If your going to use node I recommend you use a NoSQL database like couch or mongodb (Try mongoose if your using mongo).
An awesome utility library that allows you to code in a functional style (think python or ruby). This is highly recommended although most of the features are already part of ES5. Using this on the client to emulate ES5 is also a great advantage
Backbone is a lightweight MVC abstraction. This allows you to use more commonly known MVC constructs. For node.js itself I would recommend using Backbone.Model
and Backbone.Collection
and having express handle the view rendering (but populating the views with data from collections and models). You can also easily overwrite Backbone.Sync
to interact with your database abstraction of choice which virtually turns Backbone into an ORM. A solid alternative would be Spine
Futures gives you a promises API. This is great for writing manageable readable code. It also stops you from nesting callbacks 5 layers deep. The library itself extensive. It also provides nice abstractions for running asynchronous callbacks in sequence, and for running them in parallel with a callback handler at the end.
3 Months later
After having done a few projects, I would still recommend express. However.
I do not recommend
Things I would recommend.
jQuery, MooTools and Node.js are all "pure" Javascript if that's what you're asking. However, all of them are also libraries, and you will indeed have to learn their API.
You can find documentation for Node.js here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With