Skip to content

v0.2.2

Compare
Choose a tag to compare
@joshuawright11 joshuawright11 released this 14 Sep 06:52
· 166 commits to main since this release
ba39656

This release adds support for running your server over TLS and HTTP/2.

By default, the server runs unencrypted over HTTP/1.1.

Enable TLS

To enable running HTTP/1.1 over TLS, use useHTTPS.

func boot() throws {
    try useHTTPS(key: "/path/to/private-key.pem", cert: "/path/to/cert.pem")
}

Enable HTTP/2

To enable HTTP/2 upgrades (will prefer HTTP/2 but still accept HTTP/1.1 over TLS), use useHTTP2.

func boot() throws {
    try useHTTP2(key: "/path/to/private-key.pem", cert: "/path/to/cert.pem")
}

Note that the HTTP/2 protocol is only supported over TLS, so implies using it. Thus, there's no need to call both useHTTPS and useHTTP2; useHTTP2 sets up both TLS and HTTP/2 support.