예제 #1
0
 private static IApplicationBuilder UseVoyagerSettingsMiddleware(
     this IApplicationBuilder applicationBuilder,
     VoyagerOptions options)
 {
     return(applicationBuilder.Map(
                options.Path.Add(new PathString("/settings.js")),
                app => app.UseMiddleware <SettingsMiddleware>(options)));
 }
예제 #2
0
        public SettingsMiddleware(
            RequestDelegate next,
            VoyagerOptions options)
        {
            Next     = next;
            _options = options
                       ?? throw new ArgumentNullException(nameof(options));

            Uri uiPath    = UriFromPath(options.Path);
            Uri queryPath = UriFromPath(options.QueryPath);

            _queryPath = uiPath.MakeRelativeUri(queryPath).ToString();
        }
예제 #3
0
        public static IApplicationBuilder UseVoyager(
            this IApplicationBuilder applicationBuilder,
            VoyagerOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(applicationBuilder
                   .UseVoyagerSettingsMiddleware(options)
                   .UseVoyagerFileServer(options.Path));
        }