grouping common express middleware into reusable functions