One of the many reasons why I really like working for Towers Watson is being able to expand my knowledge and grow. It has been quite challenging because who am I to be teaching something to some of these very seasoned developers? Regardless I try my best. So I have prepared a presentation on Node.js.
npm install <some-package> [--save-dev]
If you want the package installed globally then you can tack on -g or just leave it off. The default saves the package globally.
What if I already have a package.json file? How do I install the packages then?
In a little bit we will go over how you can extend upon the packages. For right now I want to take us over some basic examples of the Node.js api. The first file I have is a very simple http server. It will respond to a http request in a browser. Once it gets a request it simply pushes HelloWorld to the client.
Simple enough stuff. Now where would we be without some TCP connections? Below I have an example of a server and client connecting on the TCP layer. With this implementation you can send any message to the server and the server will apply some mystifications then send the message back to the client.
I have created a very basic chat client and published it on github. I have a few branches that have the information I described above. If you want to try to set it up yourself and walk through the process, the
start branch is a good place to start. If you want to see what I have, checkout
chat. This is implemented using libraries built on node.js. I am using Socket.io and Express.
Subscribe to Rizowski's Blog
Get the latest posts delivered right to your inbox