Created
February 7, 2020 00:22
-
-
Save fransafu/e8c240945ab41e8f6446ee46dfbd5533 to your computer and use it in GitHub Desktop.
[Node.js] Servidor HTTP simple en el puerto 8080
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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