HTTP Api’s often use the url path to identify resource name, id and possibly an action. These parts of the URL path are divided by the /
character. Here is an example of using path parameters to implement a key value store where data is saved using the following request GET /set/$key/$value
and retrieved using the request GET /get/$key
using only the standard library.
Go Playground: https://go.dev/play/p/d6PvbPjXQRE
Using the code
$ go run http2.go
starting server at :8080
$ curl localhost:8080/set/foo/bar
$ curl localhost:8080/get/foo
bar