Fix server.js to route requests only once to a handler

You should make sure that you call your handler only once during code execution.