/
Startup.cs
45 lines (39 loc) · 1.26 KB
/
Startup.cs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.DotNet.Interactive.AspNetCore;
internal class Startup
{
public IApplicationBuilder App { get; private set; }
public IEndpointRouteBuilder Endpoints { get; private set; }
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(options =>
{
options.AddPolicy("AllowAll",
builder =>
{
builder
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials()
.SetIsOriginAllowed(_ => true);
});
});
}
public void Configure(IApplicationBuilder app)
{
App = app.New();
App.UseRouting();
App.UseCors("AllowAll");
App.UseEndpoints(endpoints =>
{
Endpoints = endpoints;
});
app.Use(next =>
httpContext =>
App.Build()(httpContext));
}
}