Compare commits
No commits in common. "0c59f2950907e4ed040f487f457e9f03308515f7" and "8353920f6030bead141de7a3060be04bb059dcf7" have entirely different histories.
0c59f29509
...
8353920f60
3 changed files with 2 additions and 45 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
zig-out/
|
zig-out/
|
||||||
.zig-cache/
|
zig-cache/
|
||||||
*.core
|
*.core
|
||||||
static/
|
static/
|
||||||
.jetzig
|
.jetzig
|
||||||
src/app/database/data.db-journal
|
src/app/database/data.db-journal
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
const std = @import("std");
|
|
||||||
const jetzig = @import("jetzig");
|
|
||||||
|
|
||||||
pub const static_params = .{
|
|
||||||
.index = .{
|
|
||||||
//.{ .params = .{ .foo = "hi", .bar = "bye" } },
|
|
||||||
//.{ .params = .{ .foo = "hello", .bar = "goodbye" } },
|
|
||||||
},
|
|
||||||
//.get = .{
|
|
||||||
// .{ .id = "1", .params = .{ .foo = "hi", .bar = "bye" } },
|
|
||||||
// .{ .id = "2", .params = .{ .foo = "hello", .bar = "goodbye" } },
|
|
||||||
//},
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn index(request: *jetzig.StaticRequest, data: *jetzig.Data) !jetzig.View {
|
|
||||||
var root = try data.object();
|
|
||||||
|
|
||||||
const params = try request.params();
|
|
||||||
|
|
||||||
if (params.get("foo")) |foo| try root.put("foo", foo);
|
|
||||||
if (params.get("foo") == null) try root.put("foo", data.string("no foo"));
|
|
||||||
if (params.get("bar")) |bar| try root.put("bar", bar);
|
|
||||||
if (params.get("bar") == null) try root.put("bar", data.string("no bar"));
|
|
||||||
|
|
||||||
return request.render(.ok);
|
|
||||||
}
|
|
||||||
|
|
||||||
//pub fn get(id: []const u8, request: *jetzig.StaticRequest, data: *jetzig.Data) !jetzig.View {
|
|
||||||
// var root = try data.object();
|
|
||||||
//
|
|
||||||
// const params = try request.params();
|
|
||||||
//
|
|
||||||
// if (std.mem.eql(u8, id, "1")) {
|
|
||||||
// try root.put("id", data.string("id is '1'"));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (params.get("foo")) |foo| try root.put("foo", foo);
|
|
||||||
// if (params.get("bar")) |bar| try root.put("bar", bar);
|
|
||||||
//
|
|
||||||
// return request.render(.created);
|
|
||||||
//}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
<div>{{.foo}}</div>
|
|
||||||
<div>{{.bar}}</div>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue