create function in app.js