Sunday 27 January 2019

fs.readFile wont let to end the connection

router.get('/', (req, res) => {`fs.readFile('/index.html', (err, data) => {` `if (err) throw err;` `var $ = cheerio.load(data);` `$('a#archive').attr('href', baseURL+'/archive');` `res.status(200).end($.html());` `});` });​"fs.readFile()" makes the browser wait although the data was sent (the browser writes "Waiting for localhost..."),when i look at the "Network" tab in "Inspect Elements" i see the packet with the file's data i've sent from the server side but it wont show it because the browser is waiting for the server to end the connection.

Submitted January 27, 2019 at 01:55PM by Bar771

No comments:

Post a Comment