factor out app.route() function