refactor server.js and index.html