Bot releases are visible (Hide)
Update to Zig 0.13
With the help of our awesome contributers, we have a new release:
mimetypeRegister
and mimetypeClear
methodAsEnum
supports the HEAD
method.Note: there now is a zig-master
branch that gets updated with breaking changes of Zig master on a somewhat regular basis. Please feel free to send PRs.
Many thanks again to everyone who helped out:
Giuseppe Cesarano (1):
fix: _debug typo in startWithLogging
Joe Koop (1):
update http.zig to rfc9110 using MDN as a reference
Lord Asdi (1):
fix: use std.process.getEnvVarOwned instead of std.posix.getenv
Louis Pearson (8):
fix: last_modifed -> last_modified
fix: docserver: server wasm with correct mimetype
feat: Wrap mimetypeRegister and mimetypeClear
fix: move getHeaderCommon to zap.zig
feat: add parseAccept
feat: make example for parseAccept
fix: simplify accept header api somewhat
feat: pre-allocate enough space for accept items
Michael Wendt (1):
feat: remove deprecated path
Rene Schallner (18):
Update hello_json.zig
fix docserver invocation from build.zig
proposed change to parseAccept API
make zap master build with zig master
update zig version
updated zig-master check in CI
update badge in README
corrected release templates
Sören Michaels (1):
feat: add HEAD Method to methodAsEnum
geemili (1):
feat: streamline depending on zap by linking facil.io to module
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.8.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.8.0.tar.gz",
.hash = "12209936c3333b53b53edcf453b1670babb9ae8c2197b1ca627c01e72670e20c1a21",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.8.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.8.0.tar.gz",
.hash = "12209936c3333b53b53edcf453b1670babb9ae8c2197b1ca627c01e72670e20c1a21",
},
},
.paths = .{
"",
},
}
Then, in your build.zig
's build
function, add the following before
b.installArtifact(exe)
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
.openssl = false, // set to true to enable TLS support
});
exe.root_module.addImport("zap", zap.module("zap"));
Published by github-actions[bot] 6 months ago
Update to Zig 0.12
With the help of our awesome contributers, we have a new release:
std.http
clientgetHeaderCommon
to zap.Request
zap.Request.sendError()
Users of sendError()
: the API has changed! The doc comment has been updated. The new way of using it is:
r.sendError(err, if (@errorReturnTrace()) |t| t.* else null, 505);
The new version outputs much nicer error traces.
Note: there will likely be a zig-master
branch in the future that gets updated with breaking changes of Zig master. For sanity reasons, it will not be called zig-0.13.0
but zig-master
. I'll update the README accordingly then.
Note 2: I merged PRs and fixed the tests while waiting for my plane to board, then finished on the plane. If I might have rushed it and oopsied something up, I'll apologize and follow up with a bugfix release.
One open issue is using openssl on macOS, especially with openssl in custom locations, like homebrew-installed versions. If anyone wants to look into that: PRs are welcome 😊!
Many thanks again to everyone who helped out!
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.7.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.7.0.tar.gz",
.hash = "1220a1cb1822ea77083045d246db5d7a6f07a8ddafa69c98dee367560f9ce667fd8d",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.7.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.7.0.tar.gz",
.hash = "1220a1cb1822ea77083045d246db5d7a6f07a8ddafa69c98dee367560f9ce667fd8d",
},
},
.paths = .{
"",
},
}
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"));
Published by github-actions[bot] 7 months ago
Breaking change in zap.Router
Latest zig master does not allow for multiple copies of the same anonymous type anymore. This broke zap.RequestHandler used by zap.Router.
So I rewrote zap.Router and zap.RequestHandler is gone.
To keep the APIs identical for both zig versions, I applied the rewrite patch also to the zig 0.11.0 (master) branch.
From a user perspective not much changed:
zap.Router.handle_route_unbound
.zap.Router.on_request_handler()
to get the request function to pass to a Listener.Note: the 0.12.0 branch is currently broken with regard to tests due to changes in std.http
.
Changelog in alphabetical order:
GitHub Action (1):
Update README
Rene Schallner (2):
trying to add mastercheck badge to README
re-write of zap.Router, fix #83
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.6.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.6.0.tar.gz",
.hash = "1220a5a1e6b18fa384d8a98e5d5a25720ddadbcfed01da2e4ca55c7cfb3dc1caa62a",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.6.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.6.0.tar.gz",
.hash = "1220a5a1e6b18fa384d8a98e5d5a25720ddadbcfed01da2e4ca55c7cfb3dc1caa62a",
}
}
}
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"));
Published by github-actions[bot] 8 months ago
Request.methodAsEnum() and Windows build error message
This is a small update of recent PRs. Thanks for the great contributions!
See the changelog below for individual contributions.
zap.Request.methodAsEnum()
returns HTTP method as enum or .UNKNOWN
zap.Request
now supports getParamSlice()
and getParamSlices()
getParamStr()
.I updated the docs and zig-0.12.0 branch, too, as with all recent and future releases.
Changelog in alphabetical order:
Froxcey (4):
Use std.http.Method for Request.method
Use custom method enum
Provide Windows error message
Use debug.err and exit 1 for windows fail message
Joe Liotta (1):
fixed unneeded optional unwrap in hello_json
Rene Schallner (8):
Update README.md to point out even more prominently the zig master situation
Merge pull request #72 from Chiissu/master
Merge pull request #75 from Chiissu/windows-errmsg
access raw query params w/o allocator, close #40
cosmetics
Merge pull request #79 from joeypas/master
fix workflow to detect failing builds of individual samples
in http.methodToEnum use std.meta.stringToEnum
performance: revert r.method enum back to ?[]const u8
(new http.Method enum is available via r.methodAsEnum())
use methodAsEnum() in Endpoint, and in json example
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.5.1
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.5.1.tar.gz",
.hash = "1220d4802fb09d4e99c0e7265f90d6f3cfdc3e5e31c1b05f0924ee2dd26d9d6dbbf4",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.5.1
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.5.1.tar.gz",
.hash = "1220d4802fb09d4e99c0e7265f90d6f3cfdc3e5e31c1b05f0924ee2dd26d9d6dbbf4",
}
}
}
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"));
Published by github-actions[bot] 9 months ago
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 itselfsimple_router
: example demonstrating the aboveThanks again to StringNick!
I updated the zig-0.12.0 branch, too, as with all recent and future releases.
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"));
Published by github-actions[bot] 9 months ago
Breaking API Cleanup
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;
So, I spent a few days with a first pass of cleaning up Zap's API, informed by using it in production for over half a year now.
Refactored:
Simple
.
zap.fio
.All examples and tests have been updated. Also, check out the documentation (work in progress).
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.4.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.4.0.tar.gz",
.hash = "1220a20e883195793cff0f298d647d35f675ad25e6556fe75b9ccabc98a349cbf082",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.4.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.4.0.tar.gz",
.hash = "1220a20e883195793cff0f298d647d35f675ad25e6556fe75b9ccabc98a349cbf082",
}
}
}
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"));
Published by github-actions[bot] 9 months ago
-Dopenssl is back && breaking mustache changes
Thanks to @Vemahk, -Dopenssl=true
is back! Apparently, while trying to pass user-defined options from a dependent project to zap, I typoed the working solution, and several people pointed out to me that it's as simple as:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
.openssl = false, // set to true to enable TLS support
});
As a result, we re-introduced -Dopenssl
, use it if present, and fall back to the ZAP_USE_OPENSSL
env var (set to true
to enable) if not.
Aaand: thanks to @Chooky (BrookJeynes on GH), we have a new, clean, zig-iomatic, documented Mustache API in Zap now:
var mustache = try Mustache.fromData("{{some_item}} {{& nested.item }}");
defer mustache.deinit();
const b = mustache.build(.{
.some_item = 42,
.nested = .{
.item = 69,
},
});
defer b.deinit();
if(b.str()) |s| {
std.debug.print("{s}", .{s});
};
Checkout mustache.zig and the mustache example to learn more.
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.3.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.3.0.tar.gz",
.hash = "1220697520f1fc8c511db31bb99d3adae035b83abbc9752de59c3a5ac4f22e7a90fa",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.3.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.3.0.tar.gz",
.hash = "1220697520f1fc8c511db31bb99d3adae035b83abbc9752de59c3a5ac4f22e7a90fa",
}
}
}
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"));
Published by github-actions[bot] 10 months ago
TLS / HTTPS / openssl build change!!!
Previously, zap required -Dopenssl=true
to build openssl support. Turns out, for projects using zap, it's insanely hard if not impossible to pass the user provided option openssl=true
down to the zap dependency.
As a workaround, I changed the build so that it now expects an environment variable ZAP_USE_OPENSSL
be set to true
.
So, to build the https example, run:
ZAP_USE_OPENSSL=true zig build run-https
The Example
Create the certificate and key file:
$ openssl req -x509 -nodes -days 365 -sha256 -newkey rsa:2048 -keyout mykey.pem -out mycert.pem
Build / run the example
$ ZAP_USE_OPENSSL=true zig build https
$ ZAP_USE_OPENSSL=true zig build -Dopenssl=true run-https
Issue an HTTPS request:
$ curl -v -k https://localhost:4443/build.zig
Using openssl in your code is super simple:
const tls = zap.fio_tls_new(
"localhost:4443",
CERT_FILE,
KEY_FILE,
null, // key file is not password-protected
);
defer tls.deinit();
That tls
data is then passed to the SimpleHttpListener
:
var listener = zap.SimpleHttpListener.init(.{
.port = 4443,
.on_request = on_request_verbose,
.log = true,
.max_clients = 100000,
.tls = tls, // <----- h e r e
});
try listener.listen();
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.2.6
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.6.tar.gz",
.hash = "1220140b2cdb01223ebd9c8d9f978df8a4b5c50b75f2170ed6af4cb477374511b8eb",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.2.6
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.6.tar.gz",
.hash = "1220140b2cdb01223ebd9c8d9f978df8a4b5c50b75f2170ed6af4cb477374511b8eb",
}
}
}
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"));
Published by github-actions[bot] 10 months ago
Community PR update: HTTP options support!
Hey, things are moving rapidly in ZAP land these days. StringNick (on GitHub) provided a PR adding HTTP options support!
Many thanks for the great PR!
BTW: New stuff is cooking in the 0.12.0 branch. Check out @Chooky 's new mustache ;-). Maybe even in the API docs?
(zig build run-docserver
is your friend)
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.2.5
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.5.tar.gz",
.hash = "1220c33e0ecc01b862ff6d929a948f5a8b5526a66f8d883a6d10eaff1620b8d4d605",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.2.5
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.5.tar.gz",
.hash = "1220c33e0ecc01b862ff6d929a948f5a8b5526a66f8d883a6d10eaff1620b8d4d605",
}
}
}
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"));
Published by github-actions[bot] 10 months ago
FIX tls.zig
In the heat of the action, I forgot to add tls.zig in 0.2.3. Ooops.
It's present in 0.2.4
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.2.4
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.4.tar.gz",
.hash = "1220b22285fd80b8e027bf877a1f66833934b8639cc4fc38c84fbbbcee5b2d6f6a8f",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.2.4
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.4.tar.gz",
.hash = "1220b22285fd80b8e027bf877a1f66833934b8639cc4fc38c84fbbbcee5b2d6f6a8f",
}
}
}
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"));
Published by github-actions[bot] 10 months ago
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.
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"));
Published by github-actions[bot] 10 months ago
TLS / HTTPS / openssl support!!!
Thanks to @ColaNova's (GitHub) work, Zap can now utilize facil.io's openssl support.
In the README, at the bottom of the list of examples, there is now a super simple https
example.
It's super simple:
const tls = zap.fio_tls_new(
"localhost:4443",
CERT_FILE,
KEY_FILE,
null, // key file is not password-protected
);
That tls
data is then passed to the SimpleHttpListener
.
The example requires -Dopenssl=true
on the command line. This is so that zap doesn't depend on openssl unconditionally.
Here's what happened:
fio patches from https://github.com/CoalNova/facil.io 0.7.6-zapped branch:
* b0a7b00b - (HEAD -> 0.7.6-zapdate, coalnova/0.7.6-zapdate) Update to description (7 weeks ago) <coalnova>
* 115d07d6 - Update to delocalize OpenSSL lines (7 weeks ago) <coalnova>
* 73619a8b - Update to organize build options for TLS (7 weeks ago) <coalnova>
* 16024c0d - Update to build settings (7 weeks ago) <coalnova>
* c487bb00 - Update to fix to library name (7 weeks ago) <coalnova>
* a87818fc - Update to flag HAVE_OPENSSL as build feature (8 weeks ago) <coalnova>
* 968993b4 - Update to co/remove TODO: delete me! (8 weeks ago) <coalnova>
* 094ac99d - Update to differentiate exitcodes in TLS functions (8 weeks ago) <coalnova>
* 6d22411a - Update to expose both sets of tls functions (8 weeks ago) <coalnova>
* 007f7b19 - Update switched fio_tls_missing to fio_tls_openssl (9 weeks ago) <coalnova>
* 026c92fc - Update to expose TLS C and Header files. (9 weeks ago) <coalnova>
!Important!: @CoalNova commented out one #if HAVE_OPENSSL
in the C code. I will not do that as the build.zig
will set this flag anyway. If the flag isn't specified, facil.io will compile like it did before the introduction of zap's OpenSSL support.
Addition: I had to replace the #if HAVE_OPENSSL
in question to #ifdef HAVE_OPENSSL
or else clang would complain. Maybe this error was the motivation for @CoalNova to remove the #if
.
Also, since we don't install headers of facil.io anymore (as zap is the only consumer), I skipped installing facil.io's tls headers.
Basically 2 patches:
- [Update to include basic TLS functions](https://github.com/CoalNova/zap/commit/124a3134ca71bf41635320c0bc3c098a65aba931.patch)
- [Update to expose further functions for TLS/SSL](https://github.com/CoalNova/zap/commit/14b05451989ec66e84feae9b8efc52e4f8bed1e8.patch)
Used those but skipped the build.zig.zon stuff.
OpenSSL needs to be hidden behind a custom build option orelse all projects that depend on zap will also depend on a working openssl + libcrypto dev setup: having headers and lib installed on the system.
Trying stuff from the command line first.
Creating the certificate and key file:
$ openssl req -x509 -nodes -days 365 -sha256 -newkey rsa:2048 -keyout mykey.pem -out mycert.pem
Serving the current dir:
$ openssl s_server -accept 4443 -cert mycert.pem -key mykey.pem -WWW
Issuing an HTTPS request:
$ curl -v -k https://localhost:4443/build.zig
$ zig build -Dopenssl=true https
$ zig build -Dopenssl=true run-https
It's super simple:
const tls = zap.fio_tls_new(
"localhost:4443",
CERT_FILE,
KEY_FILE,
null, // key file is not password-protected
);
That tls
data is then passed to the SimpleHttpListener
.
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.2.2
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.2.tar.gz",
.hash = "1220124603a1d655a772197781547c8c3d1ee58f263be29a6cd8a4b93a26407ae68b",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.2.2
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.2.tar.gz",
.hash = "1220124603a1d655a772197781547c8c3d1ee58f263be29a6cd8a4b93a26407ae68b",
}
}
}
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"));
Published by github-actions[bot] 10 months ago
Build-fix Release
The new facil.io build wasn't installing the lib, so builds broke.
This has been fixed. (Fixes #56)
Sorry for the inconvenience.
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.2.1
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.1.tar.gz",
.hash = "12202c27678a615f45e786aa74ce00b97a9f104f0ac4624ebc7487e66427c705cb40",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.2.1
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.1.tar.gz",
.hash = "12202c27678a615f45e786aa74ce00b97a9f104f0ac4624ebc7487e66427c705cb40",
}
}
}
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"));
Published by github-actions[bot] 10 months ago
ZAP just swallowed its dependency to our fork of facil.io
This will make hacking on facil.io (e.g. to support TLS) and future refactorings much easier.
Since ZAP is the only project that uses our facil.io fork, it made sense to ultimately integrate it.
No new features in this release!
We also got rid of the -pre
version postfix. Zap has been running fine in production for > 6 months now without any hiccups 😊.
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.2.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.0.tar.gz",
.hash = "1220614483f9638f29c6c1bf07c03e945ea28a1055b82f500d3628f4134dc582b6ed",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.2.0
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.2.0.tar.gz",
.hash = "1220614483f9638f29c6c1bf07c03e945ea28a1055b82f500d3628f4134dc582b6ed",
}
}
}
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"));
Published by github-actions[bot] about 1 year ago
Community Patch: Mustache Revamp Update (BREAKING CHANGE)
Thanks to @sadbeast on GitHub, new Mustache functionality has been
added: file-based and partial templates! We took the opportunity to
simplify and ziggify the interface of the Mustache related functions.
MustacheLoadArgs
struct has only optional slices for convenienceHere is the MustacheLoadArgs
struct used for passing into the Mustache
creation functions:
/// Mustache load args used in mustacheNew
pub const MustacheLoadArgs = struct {
/// optional filename, enables partial templates on filesystem
filename: ?[]const u8 = null,
/// optional string data. should be used if no filename is specified.
data: ?[]const u8 = null,
};
You can now create a Mustache
via the following functions:
/// use if both filename and data need to be passed
pub fn mustacheNew(load_args: MustacheLoadArgs) MustacheError!*Mustache;
/// use if only data needs to be passed
pub fn mustacheData(data: []const u8) MustacheError!*Mustache;
/// use if only filename needs to be passed
pub fn mustacheLoad(filename: []const u8) MustacheError!*Mustache;
So, real use cases look like this:
const lM = try zap.mustacheLoad("./src/tests/testtemplate.html");
const dM = try zap.mustacheData(template);
const cM = zap.mustacheNew(.{
.filename = "test.html",
.data = "{{=<< >>=}}<<>testpartial.html>>",
});
Again, many thanks to @sadbeast for improving the Mustache situation!
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.14-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.14-pre.tar.gz",
.hash = "122067d12bc7abb93f7ce623f61b94cadfdb180cef12da6559d092e6b374202acda3",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.14-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.14-pre.tar.gz",
.hash = "122067d12bc7abb93f7ce623f61b94cadfdb180cef12da6559d092e6b374202acda3",
}
}
}
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"));
Published by github-actions[bot] about 1 year ago
Late Night Bugfix Release
The multi-part multi-file upload had a serious bug, and zap didn't check for potentially invalid array items correctly.
All that is fixed with this release.
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.13-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.13-pre.tar.gz",
.hash = "12208cbd661a48011463659e664335ecc0ea2b121bb1ec0d4406e2326edafa864db8",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.13-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.13-pre.tar.gz",
.hash = "12208cbd661a48011463659e664335ecc0ea2b121bb1ec0d4406e2326edafa864db8",
}
}
}
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"));
Published by github-actions[bot] about 1 year ago
Multi-File Form Upload
Our power-user @edyu tested the file upload from the previous release
and reported it only supports single files.
This is fixed in this release. The bindataformpost
example has been
updated, too.
Many thanks to @edyu for pushing the state of Zap forward!
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.12-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.12-pre.tar.gz",
.hash = "1220326b9075805c0b9982a80fb641e04ff31deacec011b1f46de0b75d6a6af26d26",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.12-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.12-pre.tar.gz",
.hash = "1220326b9075805c0b9982a80fb641e04ff31deacec011b1f46de0b75d6a6af26d26",
}
}
}
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"));
Published by github-actions[bot] about 1 year ago
Support for binary file transmission via FORM POST
This is supposed to close #41 (thx @edyu !).
See the bindataformpost example for more details.
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.11-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.11-pre.tar.gz",
.hash = "1220fc2f57c129585f511feb3cbe5dc2e9f8648f6e3c3b6f84642f812ab1efc40a14",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.11-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.11-pre.tar.gz",
.hash = "1220fc2f57c129585f511feb3cbe5dc2e9f8648f6e3c3b6f84642f812ab1efc40a14",
}
}
}
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"));
Published by github-actions[bot] about 1 year ago
Zig Catch-Up Release
Zig's std library introduced a few breaking changes regarding std.Build
.
With this release, Zap will work with the latest zig again.
Tested with zig 0.11.0-dev.4334+928d43f61
.
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.10-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.10-pre.tar.gz",
.hash = "1220a645e8ae84064f3342609f65d1c97e23c292616f5d1040cdf314ca52d7643f8a",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.10-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.10-pre.tar.gz",
.hash = "1220a645e8ae84064f3342609f65d1c97e23c292616f5d1040cdf314ca52d7643f8a",
}
}
}
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"));
Published by github-actions[bot] about 1 year ago
Static (musl) Build Community Update
Thanks to @mattnite, zap projects can now be built using the
x64_64-linux-musl
target, which enables the building static
executables for Linux. (-Dtarget=x86_64-linux-musl
).
So, while I was on vacation, Matt just fixed everything with basically a
one-liner, really, really elegantly.
To me, this improvement is HUGE, as it means everybody can build
servers on their laptops, then just copy them onto a server machine or
into a (Docker) container, as a means of deployment, without having to
care about any other build environments.
Damn, I love Zig and working with clever people who dig into stuff like
musl builds. (@ed.yu also contributed a lot!).
Writing servers in Zig has paid off big time to me already, and will do
so even more now, as musl build deployments will def. speed up my
workflows.
So, thanks to y'all, it's been a great vacation, with great progess on
Zap - what more can one ask for 😊?
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.9-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.9-pre.tar.gz",
.hash = "12201e3ee597a7d9f98dc7fd19492403d754a1da101d2e678795e330c0382ff02f6a",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.9-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.9-pre.tar.gz",
.hash = "12201e3ee597a7d9f98dc7fd19492403d754a1da101d2e678795e330c0382ff02f6a",
}
}
}
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"));