Exemplo n.º 1
0
        public BacklightMiddleware(RequestDelegate next, MiddlewareConfiguration configuration, IndexHtmlLoader idexHtmlLoader, IWebHostEnvironment webHostEnvironment, ILoggerFactory loggerFactory)
        {
            this.configuration  = configuration;
            this.idexHtmlLoader = idexHtmlLoader;
            var staticFileOptions = StaticFileOptionsFrom(new UIStaticFilesProvider());

            staticFilesMiddleware = new StaticFileMiddleware(next, webHostEnvironment, staticFileOptions, loggerFactory);
        }
Exemplo n.º 2
0
        public static IApplicationBuilder UseBacklight(this IApplicationBuilder applicationBuilder, Action <MiddlewareConfiguration> setupAction = null)
        {
            var configuration = new MiddlewareConfiguration();

            if (setupAction != null)
            {
                setupAction(configuration);
            }
            return(applicationBuilder.UseMiddleware <BacklightMiddleware>(configuration, new IndexHtmlLoader())
                   .Map($"/{configuration.UrlPath}/api", ConfigureApiEndpointRunner())
                   .Map($"/{configuration.UrlPath}/openapi.json", ConfigureOpenApiEndpointRunner()));
        }