How Node.js actually responds to request in callbacks? #55074
Unanswered
MalikHamzaHanif
asked this question in
General
Replies: 1 comment 5 replies
-
Could you clarify what you mean? What behaviour are you seeing here? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
const http = require("http");
const {readFile}=require("fs")
const path=require("path")
const server = http.createServer((req, res) => {
if(req.url=="/"){
readFile(path.resolve(__dirname,"04_table.html"),(err,data)=>{
});
server.listen(5000, () => {
console.log("Server is listening");
});
in this code callback is fired and res is sent again after the res.end() is called .why does node is not throwing any error ? as it is not allowed in nodejs . like you can not sent another res once the res.end() is called. could someone please explain this to me in detail
Beta Was this translation helpful? Give feedback.
All reactions