wraps routes in closure