“Cómo crear un servidor en el nodo JS” Código de respuesta

Cómo crear un servidor en el nodo JS

// code by VARSHITH REDDY SATTI
// to create a server in node.js you should.
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.write("write html code to display you test")
  res.end();
}).listen(8080);
// save this as httpServer.js
// run this by typing node httpServer.js in the command line
// to acess your server got to http://localhost:8080
Crown Of Thorns Starfish

servidor de nodejs simple

// One Line ES6
require('http').createServer((req, res) => res.end(`You're in: ${req.url}`)).listen(8080, err => err ? console.log : console.log(`Listening on port 8080`))
Ashamed Ant

Respuestas similares a “Cómo crear un servidor en el nodo JS”

Preguntas similares a “Cómo crear un servidor en el nodo JS”

Más respuestas relacionadas con “Cómo crear un servidor en el nodo JS” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código