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
const http = require('http'); | |
const server = http.createServer((req, res) => { | |
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }); | |
/* | |
below is cool because the browser could download assets while we fetch data, | |
BUT there is a huge web breaking caveat, it seems we have to know the HTTP response code at this | |
moment in time. But we don't - what if there is a 500 during fetching? what happens if we actually need to 404? | |
Defaulting to 200 would lead to undesirable outcomes, especially with web scrapers and APM tooling. |
OlderNewer