Modified app.js for database