mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-05-14 14:06:08 +00:00
Minor tweaks to example code
This commit is contained in:
parent
b77ea5fd51
commit
50f518806a
@ -21,7 +21,7 @@ If you are interested in _Jetzig_ you will probably find these tools interesting
|
|||||||
* :white_check_mark: Sessions.
|
* :white_check_mark: Sessions.
|
||||||
* :white_check_mark: Cookies.
|
* :white_check_mark: Cookies.
|
||||||
* :white_check_mark: Error handling.
|
* :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: Headers (available but not yet wrapped).
|
||||||
* :x: Param/JSON payload parsing/abstracting.
|
* :x: Param/JSON payload parsing/abstracting.
|
||||||
* :x: Development-mode responses for debugging.
|
* :x: Development-mode responses for debugging.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<div><img class="p-3 mx-auto" src="/jetzig.png" /></div>
|
<div><img class="p-3 mx-auto" src="/jetzig.png" /></div>
|
||||||
|
|
||||||
<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>
|
</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>
|
<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>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const jetzig = @import("jetzig");
|
const jetzig = @import("jetzig");
|
||||||
|
const std = @import("std");
|
||||||
|
|
||||||
const Request = jetzig.http.Request;
|
const Request = jetzig.http.Request;
|
||||||
const Data = jetzig.data.Data;
|
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("email", data.string("user@example.com"));
|
||||||
try user.put("name", data.string("Ziggy Ziguana"));
|
try user.put("name", data.string("Ziggy Ziguana"));
|
||||||
try user.put("id", data.string(id));
|
try user.put("id", data.string(id));
|
||||||
|
try user.put("authenticated", data.boolean(true));
|
||||||
|
|
||||||
return request.render(.ok);
|
return request.render(.ok);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<div><img class="p-3 mx-auto" src="/jetzig.png" /></div>
|
<div><img class="p-3 mx-auto" src="/jetzig.png" /></div>
|
||||||
|
|
||||||
<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>
|
</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>
|
<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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user