Minor tweaks to example code

This commit is contained in:
Bob Farrell 2024-01-21 22:31:33 +00:00
parent b77ea5fd51
commit 50f518806a
4 changed files with 5 additions and 3 deletions

View File

@ -21,7 +21,7 @@ If you are interested in _Jetzig_ you will probably find these tools interesting
* :white_check_mark: Sessions.
* :white_check_mark: Cookies.
* :white_check_mark: Error handling.
* :x: Static content from /public directory.
* :white_check_mark: Static content from /public directory.
* :x: Headers (available but not yet wrapped).
* :x: Param/JSON payload parsing/abstracting.
* :x: Development-mode responses for debugging.

View File

@ -11,7 +11,7 @@
<div><img class="p-3 mx-auto" src="/jetzig.png" /></div>
<div>
<h1 class="text-3xl text-center p-3 pb-6 font-bold">Welcome to Jetzig!</h1>
<h1 class="text-3xl text-center p-3 pb-6 font-bold">{.message}</h1>
</div>
<button hx-get="/quotes/random" hx-trigger="click" hx-target="#quote" class="bg-[#39b54a] text-white font-bold py-2 px-4 rounded">Click Me</button>

View File

@ -1,4 +1,5 @@
const jetzig = @import("jetzig");
const std = @import("std");
const Request = jetzig.http.Request;
const Data = jetzig.data.Data;
@ -10,6 +11,7 @@ pub fn get(id: []const u8, request: *Request, data: *Data) anyerror!View {
try user.put("email", data.string("user@example.com"));
try user.put("name", data.string("Ziggy Ziguana"));
try user.put("id", data.string(id));
try user.put("authenticated", data.boolean(true));
return request.render(.ok);
}

View File

@ -11,7 +11,7 @@
<div><img class="p-3 mx-auto" src="/jetzig.png" /></div>
<div>
<h1 class="text-3xl text-center p-3 pb-6 font-bold">Welcome to Jetzig!</h1>
<h1 class="text-3xl text-center p-3 pb-6 font-bold">{.message}</h1>
</div>
<button hx-get="/quotes/random" hx-trigger="click" hx-target="#quote" class="bg-[#39b54a] text-white font-bold py-2 px-4 rounded">Click Me</button>