1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00

updated README, contributing

This commit is contained in:
Rene Schallner 2023-02-13 03:53:45 +01:00
parent 9189c99389
commit 2fb9ae55dc
2 changed files with 14 additions and 20 deletions

View file

@ -17,18 +17,3 @@ server](https://discord.gg/CBzE3VMb) under the handle renerocksai
Pull-requests and issues are, of course, welcome, too - and may be, for the time
being, the most both sane and GitHub-friendly way of communicating.
## The git pre-commit hook
This hook is checking for src/deps/facilio in the file list that
only lets you go through with the operation if a specific env var is set
why is that? we don't use a fork of facilio. we use their repo as submodule. on
build, we apply a patch to the submodule. after applying, the submodule is
dirty. it refers to a new head only present on the current machine. if we were
to commit the submodule now and push those changes, future git submodule update
--init calls will fail on fresh clones of the repo. We want to avoid this
mistake that easily happens if you use a `git add . && git commit` workflow. On
the other hand, if upstream facilio changes, we still want to be able to upgrade
to it by pulling the changes and recording the new head via git commit to our
own repo. Hence, just ignoring the submodule via `.gitignore` is not an option.
That's why we introduced the hook (// that gets installed on build.)

View file

@ -94,8 +94,14 @@ If you don't have an existing zig project, create one like this:
```shell
$ mkdir zaptest && cd zaptest
$ zig init-exe
$ git init
$ git init ## (optional)
```
**Note 1**: Zap is developed with zig master (0.11.0-dev.1602+d976b4e4a at the
time of writing). This version of zig has the package management features in
place that are used in the following instructions. Nix users are lucky; you can
use the existing `flake.nix` and run `nix develop` to get a development shell
providing zig, and also all dependencies to build the and run the GO, python,
and rust examples for the `wrk` performance tests.
With an existing zig project, adding zap to it is easy:
@ -122,10 +128,13 @@ To add zap to `build.zig.zon`:
}
```
Note: change the URLs to the latest commit of `zap` and `facil.io` (my fork).
**Note 2**: change the URLs to the latest commit of `zap` and `facil.io`
respectively (my fork). The latter is unlikely to change; but `zap` is likely to
change more frequently.
Then, add the following at the top of your `build.zig`'s `build` function, add
the following before `exe.install()`:
Then, in your `build.zig`'s `build` function, add the following before
`exe.install()`:
```zig
const zap = b.dependency("zap", .{
@ -222,7 +231,7 @@ pub fn main() !void {
var listener = zap.SimpleHttpListener.init(.{
.port = 3000,
.on_request = on_request,
.log = false,
.log = true,
});
try listener.listen();