refactor backend app.js