refactor Server.js