Ejemplo n.º 1
0
    public static IAppBuilder UseAngularServer(this IAppBuilder builder, string rootPath, string entryPath)
    {
        var options = new AngularServerOptions()
        {
            FileServerOptions = new FileServerOptions()
            {
                EnableDirectoryBrowsing = false,
                FileSystem = new PhysicalFileSystem(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, rootPath))
            },
            EntryPath = new PathString(entryPath)
        };

        builder.UseDefaultFiles(options.FileServerOptions.DefaultFilesOptions);
        return(builder.Use(new Func <AppFunc, AppFunc>(next => new AngularServerMiddleware(next, options).Invoke)));
    }
Ejemplo n.º 2
0
 public AngularServerMiddleware(AppFunc next, AngularServerOptions options)
 {
     _next            = next;
     _options         = options;
     _innerMiddleware = new StaticFileMiddleware(next, options.FileServerOptions.StaticFileOptions);
 }