<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>HTTP on Humus</title><link>https://z5labs.github.io/humus/services/http/</link><description>Recent content in HTTP on Humus</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://z5labs.github.io/humus/services/http/index.xml" rel="self" type="application/rss+xml"/><item><title>Serving HTTP</title><link>https://z5labs.github.io/humus/services/http/serving/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://z5labs.github.io/humus/services/http/serving/</guid><description>&lt;p&gt;The &lt;a href="https://pkg.go.dev/github.com/z5labs/humus/httpserver"&gt;&lt;code&gt;httpserver&lt;/code&gt;&lt;/a&gt;
package serves an &lt;code&gt;http.Handler&lt;/code&gt; over TLS as a &lt;code&gt;humus.Service&lt;/code&gt;. The end
user&amp;rsquo;s &lt;code&gt;Init&lt;/code&gt; sources its &lt;code&gt;Settings&lt;/code&gt;, builds the Service with
&lt;code&gt;httpserver.NewService&lt;/code&gt; and returns it, and &lt;code&gt;httpserver.Main&lt;/code&gt; runs it with
the defaults an HTTP server behind a load balancer needs: a 5s drain and a
10s grace period. Its test package,
&lt;a href="https://pkg.go.dev/github.com/z5labs/humus/httpserver/httpservertest"&gt;&lt;code&gt;httpservertest&lt;/code&gt;&lt;/a&gt;,
runs the same App in a test, on the same defaults, with an HTTP/2 client.&lt;/p&gt;
&lt;p&gt;The package serves an &lt;code&gt;http.Handler&lt;/code&gt; and has no REST DSL, which is
&lt;a href="https://z5labs.github.io/humus/services/http/openapi/"&gt;&lt;code&gt;openapi/v3&lt;/code&gt;&lt;/a&gt;&amp;rsquo;s. It exports no App, runs no health Service and serves no probes:
&lt;a href="https://pkg.go.dev/github.com/z5labs/humus/httphealth"&gt;&lt;code&gt;httphealth&lt;/code&gt;&lt;/a&gt;
answers them, as &lt;a href="#health-probes"&gt;Health probes&lt;/a&gt; describes. The design behind
everything on this page is in
&lt;a href="https://github.com/z5labs/humus/discussions/680"&gt;Proposal: HTTP server foundation&lt;/a&gt;,
with its &lt;a href="https://github.com/z5labs/humus/discussions/680#discussioncomment-18988464"&gt;revision 1&lt;/a&gt;
and &lt;a href="https://github.com/z5labs/humus/discussions/680#discussioncomment-18988543"&gt;revision 2&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Serving an API with OpenAPI</title><link>https://z5labs.github.io/humus/services/http/openapi/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://z5labs.github.io/humus/services/http/openapi/</guid><description>&lt;p&gt;The &lt;a href="https://pkg.go.dev/github.com/z5labs/humus/openapi/v3"&gt;&lt;code&gt;openapi/v3&lt;/code&gt;&lt;/a&gt;
package serves an API of typed operations, and its OpenAPI document. The end
user&amp;rsquo;s &lt;code&gt;Init&lt;/code&gt; declares each operation once, on a typed path, with a typed
handler and the codecs of its bodies, builds the API with &lt;code&gt;openapi.NewAPI&lt;/code&gt;,
and hands it to &lt;code&gt;httpserver.NewService&lt;/code&gt;, which serves it over TLS as
&lt;a href="https://z5labs.github.io/humus/services/http/serving/"&gt;Serving HTTP&lt;/a&gt; describes. The same declarations serve
the requests and write the document, so the two can&amp;rsquo;t disagree.&lt;/p&gt;
&lt;p&gt;The import path names the major version of OpenAPI the package follows, and
the package&amp;rsquo;s name is &lt;code&gt;openapi&lt;/code&gt;. Two packages beside it are opt-in, and
&lt;code&gt;openapi&lt;/code&gt; uses neither:
&lt;a href="https://pkg.go.dev/github.com/z5labs/humus/openapi/v3/jsoncodec"&gt;&lt;code&gt;jsoncodec&lt;/code&gt;&lt;/a&gt;
reads and writes JSON bodies, and
&lt;a href="https://pkg.go.dev/github.com/z5labs/humus/openapi/v3/problem"&gt;&lt;code&gt;problem&lt;/code&gt;&lt;/a&gt;
answers errors with RFC 9457 problem details. The design behind everything
on this page is in
&lt;a href="https://github.com/z5labs/humus/discussions/760"&gt;Proposal: OpenAPI endpoint DSL&lt;/a&gt;,
as its revisions
&lt;a href="https://github.com/z5labs/humus/discussions/760#discussioncomment-19010521"&gt;1&lt;/a&gt;,
&lt;a href="https://github.com/z5labs/humus/discussions/760#discussioncomment-19010578"&gt;2&lt;/a&gt;,
&lt;a href="https://github.com/z5labs/humus/discussions/760#discussioncomment-19010983"&gt;3&lt;/a&gt;,
&lt;a href="https://github.com/z5labs/humus/discussions/760#discussioncomment-19011032"&gt;4&lt;/a&gt;
and &lt;a href="https://github.com/z5labs/humus/discussions/760#discussioncomment-19011110"&gt;5&lt;/a&gt;
amend it.&lt;/p&gt;</description></item></channel></rss>