Created
June 26, 2024 11:02
-
-
Save netroy/c1933a3ffe636ad2e954b91d5bf02045 to your computer and use it in GitHub Desktop.
A static http server that always serves the same latin1 encoded text.
This file contains 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
const { createServer } = require('node:http'); | |
const data = Buffer.from( | |
`El rápido zorro marrón salta sobre el perro perezoso. ¡Qué bello día en París! Árbol, cañón, façade.`, | |
'latin1', | |
); | |
const server = createServer((req, res) => { | |
res.setHeader('Content-Type', 'text/html; charset=latin1'); | |
res.end(data); | |
}); | |
server.listen(3000, () => { | |
console.log('Server is running on http://localhost:3000'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment