Refactoring http-server.js