Updated app.js with api