var http = require('http');
http.createServer(function (req, res) {
res.writehead(200, {'Content-Type': 'text/plain'}); res.end('hola #backendpro\n');
}).listen(3000, '127.0.0.1');
console.log('Server running at [http.://127.0.0.1:3000/'][1]);
var http = require('http');
http.createServer(function (req, res) {
res.writehead(200, {'Content-Type': 'text/plain'});
res.end('hola #backendpro\n');
}).listen(3000, '127.0.0.1');
console.log('Server running at [http.://127.0.0.1:3000/'][1]);
hasta que abro el navegador y en el URL escribo localhost:3000 y me aparece lo siguiente en la consola: Mac-mini-de-Ivan:node ivan$ node holanode.js Server running at http.://127.0.0.1:3000/ /Users/ivan/Desktop/node/holanode.js:5 res.writehead(200, {'Content-Type': 'text/plain'}); ^
TypeError: res.writehead is not a function at Server. (/Users/ivan/Desktop/node/holanode.js:5:5) at emitTwo (events.js:106:13) at Server.emit (events.js:191:7) at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23) Mac-mini-de-Ivan:node ivan$ node holanode.js Server running at http://127.0.0.1:3000/ /Users/ivan/Desktop/node/holanode.js:5 res.writehead(200, {'Content-Type': 'text/plain'}); ^
TypeError: res.writehead is not a function at Server. (/Users/ivan/Desktop/node/holanode.js:5:5) at emitTwo (events.js:106:13) at Server.emit (events.js:191:7) at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
Mac-mini-de-Ivan:node ivan$ node holanode.js Server running at http.://127.0.0.1:3000/ /Users/ivan/Desktop/node/holanode.js:5 res.writehead(200, {'Content-Type': 'text/plain'}); ^
TypeError: res.writehead is not a function at Server. (/Users/ivan/Desktop/node/holanode.js:5:5) at emitTwo (events.js:106:13) at Server.emit (events.js:191:7) at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23) Mac-mini-de-Ivan:node ivan$ node holanode.js Server running at http://127.0.0.1:3000/ /Users/ivan/Desktop/node/holanode.js:5 res.writehead(200, {'Content-Type': 'text/plain'}); ^
TypeError: res.writehead is not a function at Server. (/Users/ivan/Desktop/node/holanode.js:5:5) at emitTwo (events.js:106:13) at Server.emit (events.js:191:7) at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)