Export sub-app as a middleware with a template app injected