115 Commits

Author SHA1 Message Date
Bob Farrell
aa036fde8b Implement layouts
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.
2024-03-11 22:36:18 +00:00
Bob Farrell
7e804c6935 Update Zmpl, fix issue with non-linebreak-terminated templates
Latest update normalizes input by adding a terminating linebreak to end
of input stream if not already present, fixing an issue where parsing
finalised with content still present in the char buf. A warning is also
raised requesting a bug report if this occurs.
2024-03-09 12:34:13 +00:00
Bob Farrell
de40af0dc6 Fix init on Windows, update Zmpl for Windows module path fix 2024-03-07 18:41:09 +00:00
Bob Farrell
d3a3582136 Implement init command, get rid of old init script/artifacts
Remove old bash script for setting up a new project, do everything in
Zig to make it platform agnostic and give us an easy place to add
scaffolding commands in future.
2024-03-06 22:57:11 +00:00
Bob Farrell
29f4771264 Upgrade Zmpl (latest version provides partials), fix mime map memory leak 2024-03-03 14:12:35 +00:00
Bob Farrell
d855b9f703 Implement MIME type inference
When serving content from `public/`, use MIME type lookup to provide an
appropriate content-type header.

MIME types borrowed from:

  https://mimetype.io/all-types
  https://github.com/patrickmccallum/mimetype-io/blob/master/src/mimeData.json
2024-02-26 22:38:43 +00:00
Bob Farrell
216b86c235 JSON and query param parsing/SSG params
Implement `jetzig.http.Request.params()` which parses either a JSON
request body or a query param string into a `jetzig.data.Value`.

Allow configuring params for static site generation - configure an array
of params for each endpoint which is then parsed at build time and a
separate JSON and HTML output is generated for each by invoking the
relevant view function and passing in resource ID/params. Params are
stored in generated `routes.zig` for route matching at run time.
2024-02-25 09:25:00 +00:00
Bob Farrell
280f1eaadd Update to latest Zmpl version
Fix a few bits of breakage with build - Jetzig does not have an
executable, use `demo/` which links to local Jetzig to test features.
2024-02-18 18:42:46 +00:00
Bob Farrell
31927cdb6b Static routes
Generate views defined with `request: *jetzig.http.StaticRequest` as
static content into `static/` directory so that exported JSON and HTML
can be rendered direct from disk, skipping runtime rendering.
2024-02-17 15:28:27 +00:00
Bob Farrell
9f772c8dbe Update Zmpl version 2024-02-08 19:19:22 +00:00
rimuspp
81d63d6a70
Updated zimpl to latest 2024-01-27 12:18:49 -05:00
Bob Farrell
3223146e30 Merge branch 'app-init' 2024-01-21 12:34:35 +00:00
Bob Farrell
cb52ccffb9 Error handling 2024-01-18 21:05:17 +00:00
Bob Farrell
65bb626bbc Sessions 2024-01-17 23:01:05 +00:00
Bob Farrell
7748b25e64 Templating 2024-01-15 11:05:17 +00:00