Skip to content

Commit

Permalink
some readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sethgrid committed Dec 2, 2024
1 parent f5e4366 commit 30530d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
What comes out of the box with this example implementation:

- fully unit and unit-integration testable json http web server
- tests showing graceful shutdown and context propagation
- able to spin up multiple running http servers in parallel during tests
- able to assert against the server's logged contents
- structured logging with `slog`
- bubbling key:value error data upto `slog` for better structured error logging
- bubbling key:value error data upto `slog` via the `kverr` package for better structured error logging
- fakes as test doubles, as a practical example against the need for mock and dependency injection frameworks
- uses prometheus, and you can see logs and metrics via grafana and loki in docker
- demonstrates building and testing via docker compose, see `make targets` for a list options

Some interesting choices:

- The test server takes a variadic list of log writers, but only takes the first one. This is the closest thing to an optional parameter. It makes writing tests nice because you use the same new test server constructor, and you can optionally send in a logger. This would probably be better implemented as Options.
- test servers take Options, most commonly to be used for passing in a buffer to which the server writes logs
- each request places a logger into the context and there is a package with functions for making life easier for pulling the logger out of existing contexts / requests. This includes a strange thing I did where I put in a backup logger that is kinda gross, but because it is a variadic argument, you never see it nor have to use it.
- There is a util directory. I know, I know. I still find value in a junk drawer. When it makes sense, things get pulled into their own package. And it is behind /internal/ anyway.
- For migrations, I use `goose`, but I pulled those examples out for now.
Expand Down

0 comments on commit 30530d0

Please sign in to comment.