examples/

directory
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: MIT

README

Examples

Blog examples

These are the examples used in the blog post

Library Example

Creates a simples http.Server with:

  • /long-running-job that sleeps for 10 seconds to demonstrate all active connections will finish before termination.
  • /hello that will write hi back :).
Running the example
$ go run examples/lib/http_example/main.go

You now have a HTTP server that has to endpoints:

  1. /hello which simply writes hi back.
  2. log-runing-job which is simple time.Sleep and then writes done back.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL