44 Commits

Author SHA1 Message Date
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
be85c13369 Provide interface for adding response headers 2024-02-25 14:20:22 +00:00
Bob Farrell
a07c71e725 Refactor response interface
Create `jetzig.http.Response` when `std.http.Server.Response` is created
and delegate all management of `std.http.Server.Response` to
`jetzig.http.Response`. Using this internally means we use the same
internal interface for the `Response` as the user, which gives us things
like response headers management in views for free (user simply calls
`request.response.headers.append()` etc.).
2024-02-25 10:32:34 +00:00
bobf
2ebb644421
Merge pull request #8 from jetzig-framework/json-and-query-param-parsing
JSON and query param parsing/SSG params
2024-02-25 09:29:01 +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
8c5ffcb9f6 Fix logo path 2024-02-17 16:02:52 +00:00
Bob Farrell
66f6e13741 Update README
Update checklist/contributors
2024-02-17 15:58:33 +00:00
bobf
a1933b6164
Merge pull request #5 from jetzig-framework/static-routes
Static routes
2024-02-17 15:46:38 +00:00
Bob Farrell
d52aed8a9b PR feedback
Remove `anyerror` from example definitions - we only need this in the
struct definition, no need to have explicit error set defined in
user-defined view functions.
2024-02-17 15:35:40 +00:00
Bob Farrell
8ac2afbec2 PR feedback. 2024-02-17 15:31:40 +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
6d487392a8 Add z1fire to contributors
Discord admin and public relations officer. :)
2024-02-15 22:41:18 +00:00
Bob Farrell
bdb813c521 Dump stack trace on internal server error
Provide stack trace for debugging runtime errors in debug builds
2024-02-15 21:40:21 +00:00
Bob Farrell
7958480ff7 Provide abstraction for headers
Basic abstraction wrapping existing std.http.Headers to provide a stable
interface.
2024-02-15 20:01:07 +00:00
bobf
3ba070a72a
Merge pull request #4 from Deecellar/fix
Server fix for middleware
2024-02-09 22:53:30 +00:00
rimuspp
ba52d32582 Fixing the template 2024-02-09 00:30:13 +00:00
rimuspp
0395d00b4b
Server fix for middleware 2024-02-08 19:09:54 -05:00
Bob Farrell
9f772c8dbe Update Zmpl version 2024-02-08 19:19:22 +00:00
bobf
787f8653e7
Merge pull request #3 from Deecellar/feature/middleware
Middleware Branch
2024-02-07 19:33:12 +00:00
rimuspp
0211164a78
i -> index 2024-02-07 14:13:02 -05:00
rimuspp
a80f14fb79
Less noisy output for the logs in the test application 2024-02-07 14:12:39 -05:00
rimuspp
267bf44017 Middleware created 2024-02-07 12:54:54 +00:00
Bob Farrell
5623be3e65 Add link to website to README 2024-02-04 15:32:23 +00:00
Bob Farrell
ed1ba9546f Remove unneeded title 2024-02-04 14:05:55 +00:00
Bob Farrell
f24a959ef3 Update README, add logo & discord link 2024-02-04 14:05:18 +00:00
bobf
e885c32205
Merge pull request #1 from Deecellar/0.12
0.12
2024-01-28 14:12:01 +00:00
rimuspp
81d63d6a70
Updated zimpl to latest 2024-01-27 12:18:49 -05:00
rimuspp
454208d6b5
Change in how the std.http.Server works, do() -> send(), init doesn't take an allocator anymore 2024-01-23 13:54:27 -05:00
rimuspp
7e529e2c55
Incomplete method set, Decided to just throw an unsupported error 2024-01-23 13:53:28 -05:00
rimuspp
885037646e
Init with the new step thing 2024-01-23 13:52:51 -05:00
rimuspp
6ee3b79884
Updated the api for the Build system, Added a step for the compilation of views 2024-01-23 13:51:10 -05:00
Bob Farrell
50f518806a Minor tweaks to example code dev 2024-01-21 22:31:33 +00:00
Bob Farrell
b77ea5fd51 Static content, init/setup tweaks, some cleanup 2024-01-21 20:28:27 +00:00
Bob Farrell
3223146e30 Merge branch 'app-init' 2024-01-21 12:34:35 +00:00
Bob Farrell
b0fbca6703 Init script 2024-01-20 19:40:07 +00:00
Bob Farrell
f8502be587 Log error to output and add to data 2024-01-20 19:04:56 +00:00
Bob Farrell
062ec58e67 App initialization 2024-01-20 13:45:23 +00:00
Bob Farrell
4d2bd0b86b Log error to output and add to data 2024-01-20 12:25:59 +00:00
Bob Farrell
b66073955d Colorize request method in log output 2024-01-18 22:03: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
Bob Farrell
745ab76dd3 Initial commit 2023-11-29 20:43:24 +00:00