Tutorial by Examples

A basic example of HTTP server. write following code in http_server.js file: var http = require('http'); var httpPort = 80; http.createServer(handler).listen(httpPort, start_callback); function handler(req, res) { var clientIP = req.connection.remoteAddress; var connectUsi...
a basic example for http client: write the follwing code in http_client.js file: var http = require('http'); var options = { hostname: '127.0.0.1', port: 80, path: '/', method: 'GET' }; var req = http.request(options, function(res) { console.log('STATUS: ' + res.statusCode)...

Page 1 of 1