missing else in server.js causing res.writeHead to be called twice