public AngularServerMiddleware( RequestDelegate next, AngularServerOptions options, IHostingEnvironment env, ILoggerFactory logger) { this.next = next; this.options = options; this.innerMiddleware = new StaticFileMiddleware( next, env, options.FileServerOptions.StaticFileOptions, logger); }
public static IApplicationBuilder UseAngularServer( this IApplicationBuilder builder, string rootPath, string entryPath, IHostingEnvironment env, ILoggerFactory loggerFactory) { var options = new AngularServerOptions { FileServerOptions = new FileServerOptions { EnableDefaultFiles = true, EnableDirectoryBrowsing = true, FileProvider = new PhysicalFileProvider(System.IO.Path.Combine(env.WebRootPath, rootPath)) }, EntryPath = new PathString(entryPath) }; builder.UseDefaultFiles(options.FileServerOptions.DefaultFilesOptions); return builder.Use(next => new AngularServerMiddleware(next, options, env, loggerFactory).Invoke); }