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.
Render `src/app/views/errors.zig` view (`index` action) when an
unexpected error occurs. If the view does not exist, try rendering
`public/404.html`, `public/500.html` (etc.), finally falling back to a
standard basic HTML/JSON response.
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.
Fully disambiguate request params from body and query string and clean
up convoluted code, reduce allocs. Implement
`jetzig.http.Request.queryParams` which always returns only the parsed
query string, never the request body.
Deprecate `headers.getFirstValue` in favour of `headers.get`, implement
`headers.getAll`.
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 query param is empty, use `jetzig.data.Data.NullType` - this way
the value is still non-null (i.e. can be captured) and is still a
`jetzig.data.Value` so is consistent with previous implementation.
Add very weird bugfix for 404 responses.
Fix `Bad Request` response code.
If no template present, allow the request to render the view and then
only render a 404 if the view does not redirect, otherwise all views
would need a placeholder Zmpl template even if the view does not use it.
Also parse HTTP body as query string if present.
Generate an array of `jetzig.views.Route` in `GenerateRoutes.zig` exe
instead of a meta-route that we later translate into an actual route.
This makes things much simpler for static routes at build time and
dynamic routes at run time as we no longer need to use comptime - we
just have an array of routes ready-made.
If a route isn't matched but the URI can match directly to a markdown
file, render it directly. This allows putting arbitrary markdown files
in e.g. `/foo/bar/abc.md`, `/foo/bar/def.md` and rendering them as
`/foo/bar/abc.html`, `/foo/bar/def.html`. Since markdown are static
content only (i.e. no template data etc.) it makes sense for them to be
renderable without needing to create a view for each one.