node-training-edu
Version:
Training with nodejs
29 lines (24 loc) • 723 B
JavaScript
var query = require('querystring');
function handle(request, response)
{
response.writeHead(200,{
'Content-Type': 'text/html'
});
var body = '';
request.on('data', function(data){
body += data.toString();
})
request.on('end',function () {
var decode = query.parse(body);
console.log(decode);
})
response.write('<!DOCTYPE "html" >');
response.write('<html>');
response.write('<head><title>Titulo</title></head>');
response.write('<body>');
response.write('<h1>Ola Eduardo</h1>');
response.write('</body>');
response.write('</html>');
response.end('hello from http module')
}
module.exports = handle;