my fist HelloWorld application.
var express=require('express'); //use the express module----
var app=express(); // create an object of express module
app.get('/', function (req,res){ //create a call back function
res.send('helloworld'); //send helloworld response
});
var server = app.listen(3000, function(){ make the server listen on 3000
});
1. using require function we are including the express module.
2. we need to make an object for the express module we just included.
3. create a callback function to be called whenever the user hits our root (/)
4. in the callback function, we are sending a response to the user
5. call a listen to function to make our server listens to client requests on port 3000.
done. use this web address to confirm.
localhost:3000/
Route (/):
routes reads clients input and responds to the request. say GET,POST,PUT,Delete