Update server.js

Because "res.writeHead(200, { "Content-Type": ct });" is always executes, it will make the server crash on an error event since the "res.writeHead()" can only be executed once on a res object. I'm not sure if there is a better solution than this.