Skip to content

Commit a295dc3

Browse files
committed
Show WebApplicationBuilder
1 parent a8de4b4 commit a295dc3

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/Http/samples/MinimalSample/Program.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
app.UseDeveloperExceptionPage();
1010
}
1111

12-
app.MapGet("/", (Func<string>)(() => "Hello World!"));
13-
1412
string Plaintext() => "Hello, World!";
1513
app.MapGet("/plaintext", (Func<string>)Plaintext);
1614

1715
object Json() => new { message = "Hello, World!" };
1816
app.MapGet("/json", (Func<object>)Json);
1917

20-
string SayHello(string name) => $"Hello {name}";
18+
string SayHello(string name) => $"Hello, {name}!";
2119
app.MapGet("/hello/{name}", (Func<string, string>)SayHello);
2220

2321
await app.RunAsync();

src/Http/samples/MinimalSampleFSharp/Program.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ open Microsoft.Extensions.Hosting
44

55
[<EntryPoint>]
66
let main args =
7-
let app = WebApplication.Create(args);
7+
use app = WebApplication.Create(args)
88

99
if app.Environment.IsDevelopment() then
1010
app.UseDeveloperExceptionPage() |> ignore
1111

1212
app.MapGet("/plaintext", Func<string>(fun () -> "Hello, World!")) |> ignore
1313
app.MapGet("/json", Func<obj>(fun () -> upcast {| message = "Hello, World!" |})) |> ignore
14-
app.MapGet("/hello/{name}", Func<string, string>(fun name -> $"Hello {name}")) |> ignore
14+
app.MapGet("/hello/{name}", Func<string, string>(fun name -> $"Hello, {name}!")) |> ignore
1515

1616
app.Run()
1717

src/ProjectTemplates/Web.ProjectTemplates/content/EmptyWeb-CSharp/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
using Microsoft.AspNetCore.Builder;
33
using Microsoft.Extensions.Hosting;
44

5-
await using var app = WebApplication.Create(args);
5+
var builder = WebApplication.CreateBuilder(args);
6+
await using var app = builder.Build();
67

78
if (app.Environment.IsDevelopment())
89
{

src/ProjectTemplates/Web.ProjectTemplates/content/EmptyWeb-FSharp/Program.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ open Microsoft.Extensions.Hosting
44

55
[<EntryPoint>]
66
let main args =
7-
let app = WebApplication.Create(args);
7+
let builder = WebApplication.CreateBuilder(args)
8+
use app = builder.Build()
89

910
if app.Environment.IsDevelopment() then
1011
app.UseDeveloperExceptionPage() |> ignore

0 commit comments

Comments
 (0)