clean up server file, abstract handlers to app.js