jeudi 22 janvier 2015


Table of Contents



Introduction to Node.js by M Richard

This book is intended to explain a basic concept of node.js just how to get started with node.js
Like most starter they wonder what can node do and how to move from console to something tangible like application this was the question I had when I first started learning node I mean this is real for almost all programmers

Who is this book for?

This book is for absolute beginners as is my first version of my node.js publication
And while learning this I hope you have understanding of javascript or jQuery with some understanding of html and css but not necessary.

Why learning node.js

As technology grow every day programmers need to keep up to date with most powerful and strong technology that simplify thing and do thing in good manner that is why you have to learn node.js

Get started

First download node.js at official node website and install it your PC or MAC www.nodejs.com
Or get a link here www.coursestreamer.com

How node.js work?

Node.js use http request to send and receive data through GET and POST method
And trust me all this happen in background means in interesting way! I really like it.
Let see this code: var http=require("http");
    http.createServer (function (request, response) {
        response.writeHead (200, {"context-type”: text/plain"});
        Response. Write ("hello world");
        Response. End ();
}).listen (8888);

Before explaining the above code let me talk about what we call module
There is built-in module this comes with node.js which stands for library and parser at the same time
We started creating variable named http that require http module to allow us to use http request for our application
And we used createServer to help us creating server listening on specific port here we used port 8888 which can be any port according to our choice.

Running our Codes

We installed our node.js and we have node running on our environment start and choose working folder that currently your project reside
Here is how I get on my path:   cd c: //xampp/htdocs
I am using htdocs as where my files reside
I saved the above code as starter.js
Return to node application and run this code: node starter.js
Go to your browser and run http://localhost:8888
And see the result that is to say our application is listening on port 888
And it can receive and respond to any request.
 In next article we will see how to structure our application and how to create our own module rather than using built in module and this book is written by request of article and according to what the reader of this book need so please send your request at these emails: richard@youthoughts.com , beastar457@gmail.com and learn for free at www.coursestreamer.com/richard




Aucun commentaire:

Enregistrer un commentaire