Basic Conecpts For Creating server and response code
Its a inbuilt modul with help of this module we can perform meny operationsIt Handle - Request & Response beacause it is a Hypertext Text Transfer Protocol(get request from user and give response to server)
1) For creating server we need Http module..
2) Url Handling : For Handlng Url we can use
var http = require('http'); --> inbuild module it access via direct requre method can access
var server = http.createServer(function(req , res){ ///create server
//Request Status , Content Type
server.writeHead(200,{"content-type":"text/plain"})
var url = req.url; //Url Handling
res.write(url)
res.end('Response End') //print message
}) .listen(3000);
Note : Query String = Send Variable in browser with url
Url Handling
var http = require('http'); --> inbuild module it access via dirct method
var url = require('url'); //Handling Querystring
var server = http.createServer(function(req , res){ ///create server
server.writeHead(200,{"content-type":"text/plain"})
var result = url.parse(www.google.com?id=10, true).query;
res.write(res.name); //things whinch want to get like name
}) .listen(3000);
Run-> localhost://300