Skip to content

Instantly share code, notes, and snippets.

@fransafu
Created February 7, 2020 00:22
Show Gist options
  • Save fransafu/e8c240945ab41e8f6446ee46dfbd5533 to your computer and use it in GitHub Desktop.
Save fransafu/e8c240945ab41e8f6446ee46dfbd5533 to your computer and use it in GitHub Desktop.
[Node.js] Servidor HTTP simple en el puerto 8080
// Llamar Biblioteca nativa para levantar un servidor HTTP
const http = require('http');
// Crear servidor
const server = http.createServer((req, res) => {
res.write('Hello World');
res.end();
});
// Especificar en que puerto debe escuchar el servidor las peticiones
server.listen(8080, (err) => {
if (err) throw err;
console.log('Server listen on port 8080');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment