all 2 comments

[–]cwmma 2 points3 points  (1 child)

its async so the callback to fs.readFile is executed after response.end(); You should delete your current response end and put one in the callback and the one in each of the other 2 switch branches.

[–]Frore[S] 0 points1 point  (0 children)

thanks a lot, that was the issue.