File tree Expand file tree Collapse file tree
aspnetcore/fundamentals/minimal-apis
10.0-samples/MinimalServerSentEvents Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44var builder = WebApplication . CreateBuilder ( args ) ;
55var app = builder . Build ( ) ;
66
7- app . MapGet ( "/" , ( ) => Results . Redirect ( "/json-item" ) ) ;
8-
9-
7+ // <snippet_string>
108app . 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>
2626app . 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>
4244app . 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
6165app . Run ( ) ;
6266
6367public record HearRate ( DateTime Timestamp , int HeartRate )
6468{
6569 public static HearRate Create ( int heartRate ) => new ( DateTime . UtcNow , heartRate ) ;
66- }
70+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- :::moniker range="= aspnetcore-8 .0"
1+ :::moniker range="= aspnetcore-9 .0"
22
33Minimal 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
115115The following sections demonstrate the usage of the common result helpers.
116116
Original file line number Diff line number Diff 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
1717Minimal 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
129129The following sections demonstrate the usage of the common result helpers.
130130
You can’t perform that action at this time.
0 commit comments