Skip to content

Release v0.2.3

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 30 Dec 02:54

ZAP Release v0.2.3

Updates

Refactored zap.Tls

I refactored zap.Tls to make it more zig-like:

    // this is more zig-like:
    const tls = try zap.Tls.init(.{
        .server_name = "localhost:4443",
        .public_certificate_file = CERT_FILE,
        .private_key_file = KEY_FILE,
    });
    // this, too
    defer tls.deinit();

    var listener = zap.SimpleHttpListener.init(.{
        .port = 4443,
        .on_request = on_request_verbose,
        .log = true,
        .max_clients = 100000,
        .tls = tls,
    });
    try listener.listen();

More dangerous refactorings are going to happen in the zig-0.12.0 branch, and being back-ported to master if it makes sense.

Using it

To use in your own projects, put this dependency into your build.zig.zon:

        // zap v0.2.3
        .zap = .{
            .url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.3.tar.gz",
            .hash = "1220f8764604db85c5e598a5157f1ac21e6410e941f97e6943cddc2c9d9e12794aec",
        }

Here is a complete build.zig.zon example:

.{
    .name = "My example project",
    .version = "0.0.1",

    .dependencies = .{
        // zap v0.2.3
        .zap = .{
            .url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.3.tar.gz",
            .hash = "1220f8764604db85c5e598a5157f1ac21e6410e941f97e6943cddc2c9d9e12794aec",
        }
    }
}

Then, in your build.zig's build function, add the following before exe.install():

    const zap = b.dependency("zap", .{
        .target = target,
        .optimize = optimize,
    });
    exe.addModule("zap", zap.module("zap"));
    exe.linkLibrary(zap.artifact("facil.io"));