Skip to content
Aboubacar Toure edited this page Oct 21, 2016 · 13 revisions

Table of Contents

  1. What is it?
  2. When and why to use it
  3. When and why not to use it
  4. Open questions
  5. Installation
  6. Start the server
  7. Some helpful links

What is it?

NodeJS is a run-time Javascript platform. It allows you to write applications very easily and quickly in a universal language. It is primarily used to create back-end systems for a server (but NodeJS itself is not a server). It also has a command line tool.

When and why to use it

Javascript is very good for event-based operations and long-polling applications. Long-polling allows for information to be "pushed" from the server to the client without actually pushing. The client has an open thread all the time that is listening for updates from the server, so pages can refresh without any action on the client. This is highly desirable for many applications, like chat rooms and online games. Other technologies have this capability but they are not out of the box and not as performant as NodeJS.

NodeJS is also very helpful when integrating with a front-end system that is already written in Javascript, since they would use the same language. It is very easy to learn and use, especially if you already know Javascript.

When and why not to use it

NodeJS is not very good for CPU-intensive work because all information sent to a client is on one thread. If one operation takes a long time to compute then it will hold up all of the other operations for that thread.

There are some npm packages that are not well tested or maintained, so you have to be careful or aware of which ones you are using.

Due to the abstraction of only using one thread per client, there are some restrictions in things you can do with NodeJS. Other technologies like .NET are more versatile. For example, they easily allow serialization to other languages like XML, rather than just JSON.

Open questions

Does CPU-intensive work block all clients or just one? Is there one thread per client? How does NodeJS use npm?

Installation

Download the installer from NodeJS's download page. From the nodejs folder, install the express web application framework by following these steps. Verify 'express' is installed by running npm ls

Start the Server

Run node main.js

Some helpful links

http://stackoverflow.com/questions/5062614/how-to-decide-when-to-use-node-js http://www.haneycodes.net/to-node-js-or-not-to-node-js/ http://expressjs.com/en/starter/installing.html

Clone this wiki locally