blob: 8134a8c3ab393c9ac7f335d0603b0e560dcc219e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Matching;
using Microsoft.AspNetCore.Routing.Patterns;
namespace Microsoft.AspNetCore.Builder
{
public static class EndpointRouteBuilderExtensions
{
public static IEndpointConventionBuilder MapHello(this IEndpointRouteBuilder endpoints, string pattern, string greeter)
{
if (endpoints == null)
{
throw new ArgumentNullException(nameof(endpoints));
}
var pipeline = endpoints.CreateApplicationBuilder()
.UseHello(greeter)
.Build();
return endpoints.Map(pattern, pipeline);
}
}
}
|