Skip to content

Release v0.5.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 24 Jan 22:05

ZAP Release v0.5.0

Updates

Introducing: zap.Router

Thanks to StringNick, we now have zap.Router with handler closures support!

See the simple_router example. zap.Router is missing doc comments, so if anyone wants to step up, please feel free to send a PR against the zig-0.12.0 my way.

BTW: Documentation (built on zig-0.12.0 branch) is now live at: https://zigzap.org/zap

Doc update PRs are welcome. I am especially excited about the guides feature: https://zigzap.org/zap/#G;

Introduced:

  • zap.Router: the router itself
  • `zap.RequestHandler : a nice way to capture "self" pointers of containers of request functions.
  • simple_router: example demonstrating the above

Thanks again to StringNick!

I updated the zig-0.12.0 branch, too, as with all recent and future releases.

Using it

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

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

Here is a complete build.zig.zon example:

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

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

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"));