Skip to content

Commit d4d4bb2

Browse files
committed
SSE moniker prep
1 parent 4a01e7c commit d4d4bb2

6 files changed

Lines changed: 12 additions & 30 deletions

File tree

aspnetcore/fundamentals/minimal-apis/10.0-samples/MinimalServerSentEvents/Program.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
var builder = WebApplication.CreateBuilder(args);
55
var app = builder.Build();
66

7-
app.MapGet("/", () => Results.Redirect("/json-item"));
8-
9-
7+
// <snippet_string>
108
app.MapGet("/string-item", (CancellationToken cancellationToken) =>
119
{
1210
async IAsyncEnumerable<string> GetHeartRate(
@@ -22,7 +20,9 @@ async IAsyncEnumerable<string> GetHeartRate(
2220

2321
return TypedResults.ServerSentEvents(GetHeartRate(cancellationToken), eventType: "heartRate");
2422
});
23+
// </snippet_string>
2524

25+
// <snippet_json>
2626
app.MapGet("/json-item", (CancellationToken cancellationToken) =>
2727
{
2828
async IAsyncEnumerable<HearRate> GetHeartRate(
@@ -38,7 +38,9 @@ async IAsyncEnumerable<HearRate> GetHeartRate(
3838

3939
return TypedResults.ServerSentEvents(GetHeartRate(cancellationToken), eventType: "heartRate");
4040
});
41+
// </snippet_json>
4142

43+
// <snippet_item>
4244
app.MapGet("sse-item", (CancellationToken cancellationToken) =>
4345
{
4446
async IAsyncEnumerable<SseItem<int>> GetHeartRate(
@@ -57,10 +59,12 @@ async IAsyncEnumerable<SseItem<int>> GetHeartRate(
5759

5860
return TypedResults.ServerSentEvents(GetHeartRate(cancellationToken));
5961
});
62+
// </snippet_item>
63+
6064

6165
app.Run();
6266

6367
public record HearRate(DateTime Timestamp, int HeartRate)
6468
{
6569
public static HearRate Create(int heartRate) => new(DateTime.UtcNow, heartRate);
66-
}
70+
}

aspnetcore/fundamentals/minimal-apis/10.0-samples/MinimalServerSentEvents/appsettings.Development.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

aspnetcore/fundamentals/minimal-apis/10.0-samples/MinimalServerSentEvents/appsettings.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

aspnetcore/fundamentals/minimal-apis/10.0-samples/MinimalServerSentEvents/global.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

aspnetcore/fundamentals/minimal-apis/includes/responses9.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
:::moniker range="= aspnetcore-8.0"
1+
:::moniker range="= aspnetcore-9.0"
22

33
Minimal endpoints support the following types of return values:
44

@@ -110,7 +110,7 @@ In order to document this endpoint correctly the extension method `Produces` is
110110

111111
### Built-in results
112112

113-
[!INCLUDE [results-helpers](includes/results-helpers.md)]
113+
[!INCLUDE [results-helpers](~/fundamentals/minimal-apis/includes/results-helpers.md)]
114114

115115
The following sections demonstrate the usage of the common result helpers.
116116

aspnetcore/fundamentals/minimal-apis/responses.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ uid: fundamentals/minimal-apis/responses
1212

1313
[!INCLUDE[](~/includes/not-latest-version.md)]
1414

15-
:::moniker range="> aspnetcore-9.0"
15+
:::moniker range=">= aspnetcore-10.0"
1616

1717
Minimal endpoints support the following types of return values:
1818

@@ -124,7 +124,7 @@ In order to document this endpoint correctly the extension method `Produces` is
124124

125125
### Built-in results
126126

127-
[!INCLUDE [results-helpers](includes/results-helpers.md)]
127+
[!INCLUDE [results-helpers](~/fundamentals/minimal-apis/includes/results-helpers.md)]
128128

129129
The following sections demonstrate the usage of the common result helpers.
130130

0 commit comments

Comments
 (0)