You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/README.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,4 +17,16 @@ These are the examples used in the blog post
17
17
18
18
Creates a simples http.Server with:
19
19
-`/long-running-job` that sleeps for 10 seconds to demonstrate all active connections will finish before termination.
20
-
-`/hello` that will write `hi` back :).
20
+
-`/hello` that will write `hi` back :).
21
+
22
+
### Running the example
23
+
24
+
```bash
25
+
$ go run examples/lib/http_example/main.go
26
+
```
27
+
28
+
You now have a HTTP server that has to endpoints:
29
+
1.`/hello` which simply writes `hi` back.
30
+
2.`log-runing-job` which is simple `time.Sleep` and then writes `done` back.
31
+
32
+
Now when you send a HTTP request to `/log-running-job`, and press `ctrl+c` in server, the code will wait for all requests to finish and then terminates.
0 commit comments