コード例 #1
0
        public void EnableSwaggerUi(
            string routeTemplate,
            Action <SwaggerUiConfig> configure = null)
        {
            var config = new SwaggerUiConfig(_discoveryPaths, _rootUrlResolver);

            if (configure != null)
            {
                configure(config);
            }

            _httpConfig.Routes.MapHttpRoute(
                name: "swagger_ui",
                routeTemplate: routeTemplate,
                defaults: null,
                constraints: new { assetPath = @".+" },
                handler: new SwaggerUiHandler(config)
                );

            if (routeTemplate == DefaultRouteTemplate)
            {
                _httpConfig.Routes.MapHttpRoute(
                    name: "swagger_ui_shortcut",
                    routeTemplate: "swagger",
                    defaults: null,
                    constraints: null,
                    handler: new RedirectHandler(_rootUrlResolver, "swagger/ui/index"));
            }
        }
コード例 #2
0
ファイル: SwaggerUiHandler.cs プロジェクト: dym0080/ABPstudy
 public SwaggerUiHandler(SwaggerUiConfig config)
 {
     _config = config;
 }
コード例 #3
0
 public SwaggerUiHandler(SwaggerUiConfig config)
 {
     _config = config;
 }