コード例 #1
0
        private static MidFunc Index(IndexResource index)
        {
            var response = index.Get();

            Task Index(HttpContext context, Func <Task> next) => context.WriteResponse(response);

            return(Index);
        }
コード例 #2
0
 private static Action <IApplicationBuilder> Configure(IndexResource index)
 => builder => builder
 .UseMiddlewareLogging(typeof(IndexMiddleware))
 .MapWhen(HttpMethod.Get, inner => inner.UseAccept(Constants.MediaTypes.HalJson).Use(Index(index)))
 .UseAllowedMethods(index);
コード例 #3
0
 public static IApplicationBuilder UseIndex(this IApplicationBuilder app, IndexResource index)
 => app.UseMiddlewareLogging(typeof(IndexMiddleware))
 .MapWhen(HttpMethod.Get, inner => inner.UseAccept(Constants.MediaTypes.HalJson).Use(Index(index)))
 .UseAllowedMethods(index);
コード例 #4
0
 public static IApplicationBuilder UseIndex(this IApplicationBuilder builder, IndexResource index)
 => builder.MapWhen(
     IsMatch,
     Configure(index));