Eradication of `data` arg to requests. We no longer need to pass this
value around as we have a) type inference, b) nested object insertion
via `put` and `append`.
Fix `joinPath` numeric type coercion
Detect empty string params and treat them as blank with expectParams()
Fix error logging/stack trace printing.
Update Zmpl - includes debug tokens + error tracing to source template
in debug builds.
Implement `request.expectParams()` to coerce params to a given struct.
`request.paramsInfo()` provides information about each param (present,
blank, failed + original values and errors where applicable).
Add `jetzig test` command which runs build step `jetzig:test`.
Add `jetzig.testing` namespace which provides test helpers and a test
app.
Add tests to view generator (i.e. include tests for generated routes).
Remove need to add all mail template params to view response data. This
was originally intended functionality but the wrong value was passed to
the `deliver` function, and no `data` argument was given, making it
cumbersome to create new values.
Create mailers with `jetzig generate mailer <name>`. Mailers define
default values for email fields (e.g. subject, from address, etc.).
Mailers use Zmpl for rendering text/HTML parts.
Send an email from a request with `request.mail()`. Call
`deliver(.background, .{})` on the return value to use the built-in
mail job to send the email asynchronously.
Improve query/HTTP request body param parsing - unescape `+` and `%XX`
characters.
Use in-memory KV store (JetKV) for simple job queue.
Build script generates an array of Zig modules in `src/app/jobs/` and
stores their name + run function (`run(allocator, params, logger)`).
View functions schedule jobs with arbitrary params.
Thread pool spawns a (configurable) number of workers and pops jobs from
the queue, then invokes the appropriate run function.
Generate a bundle that includes markdown files (needed for dynamic
markdown rendering). In future these will be compiled into static
outputs by the bundle command but for now we copy them into the source
tree. `bundle.tar.gz` includes one directory which is named after the
compiled exe, containing a `server` executable, `public` and `static`
directories, and any markdown files.
Windows support removed for now - will re-add when we overhaul all of
this to no longer do command line invocation of `tar` (we will build
tarball/Zip file ourselves).
When zig build fails, the `jetzig server` command also exits. This
should be an uninteneded behavior. This commit fixes this by catching
failed build and restart after file change is detected.
Fixes#33
The compiler doesn't pass color to the parent process unless it is
called with `--colour on`. This commit adds those arguments to add
support for coloring in compiler outputs.
Latest Zmpl provides `template.renderWithLayout(other_template, data)`,
allowing a template to be renedered within another template.
Create layouts in `src/app/views/layouts/` or use
`jetzig generate layout [name]` and set `pub const layout = "name";` in
each view file.
Runs a development server and auto-reloads when changes are detected to
files.
Note that a "change" is just an mtime update, Zig does a more
intelligent change detection so avoids unnecessary recompiles, so the
server reloads very quickly.