mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-05-14 22:16:08 +00:00
WIP
This commit is contained in:
parent
33358fa5fa
commit
a18ba77faf
19
build.zig
19
build.zig
@ -205,22 +205,25 @@ pub fn jetzigInit(b: *std.Build, exe: *std.Build.Step.Compile, options: JetzigIn
|
||||
}
|
||||
}
|
||||
|
||||
const root_path = b.build_root.path orelse try std.fs.cwd().realpathAlloc(b.allocator, ".");
|
||||
const root_path = if (b.build_root.path) |build_root_path|
|
||||
try std.fs.path.join(b.allocator, &.{ build_root_path, "src" })
|
||||
else
|
||||
try std.fs.cwd().realpathAlloc(b.allocator, "src");
|
||||
const templates_path: []const u8 = try std.fs.path.join(
|
||||
b.allocator,
|
||||
&[_][]const u8{ root_path, "src", "app" },
|
||||
&[_][]const u8{ root_path, "app" },
|
||||
);
|
||||
const views_path: []const u8 = try std.fs.path.join(
|
||||
b.allocator,
|
||||
&[_][]const u8{ root_path, "src", "app", "views" },
|
||||
&[_][]const u8{ root_path, "app", "views" },
|
||||
);
|
||||
const jobs_path = try std.fs.path.join(
|
||||
b.allocator,
|
||||
&[_][]const u8{ root_path, "src", "app", "jobs" },
|
||||
&[_][]const u8{ root_path, "app", "jobs" },
|
||||
);
|
||||
const mailers_path = try std.fs.path.join(
|
||||
b.allocator,
|
||||
&[_][]const u8{ root_path, "src", "app", "mailers" },
|
||||
&[_][]const u8{ root_path, "app", "mailers" },
|
||||
);
|
||||
|
||||
const exe_routes_file = b.addExecutable(.{
|
||||
@ -237,6 +240,7 @@ pub fn jetzigInit(b: *std.Build, exe: *std.Build.Step.Compile, options: JetzigIn
|
||||
exe_routes_file.root_module.addImport("zmpl", zmpl_module);
|
||||
|
||||
const run_routes_file_cmd = b.addRunArtifact(exe_routes_file);
|
||||
run_routes_file_cmd.has_side_effects = true;
|
||||
const source_files = b.addUpdateSourceFiles();
|
||||
const routes_file_path = run_routes_file_cmd.addOutputFileArg("routes.zig");
|
||||
source_files.addCopyFileToSource(routes_file_path, "src/routes.zig");
|
||||
@ -250,7 +254,7 @@ pub fn jetzigInit(b: *std.Build, exe: *std.Build.Step.Compile, options: JetzigIn
|
||||
mailers_path,
|
||||
});
|
||||
|
||||
const routes_module = b.createModule(.{ .root_source_file = routes_file_path });
|
||||
const routes_module = b.createModule(.{ .root_source_file = b.path("src/routes.zig") });
|
||||
routes_module.addImport("jetzig", jetzig_module);
|
||||
exe.root_module.addImport("routes", routes_module);
|
||||
exe.step.dependOn(&run_routes_file_cmd.step);
|
||||
@ -329,8 +333,7 @@ pub fn jetzigInit(b: *std.Build, exe: *std.Build.Step.Compile, options: JetzigIn
|
||||
const jetzig_compile_step = jetzig_steps.get("compile").?;
|
||||
const compile_step = b.step("compile", "Compile Zmpl templates");
|
||||
compile_step.dependOn(&jetzig_compile_step.step);
|
||||
// compile_step.dependOn(&run_routes_file_cmd.step);
|
||||
b.getInstallStep().dependOn(compile_step);
|
||||
jetzig_compile_step.step.dependOn(&source_files.step);
|
||||
|
||||
const exe_unit_tests = b.addTest(.{
|
||||
.root_source_file = tests_file_path,
|
||||
|
@ -67,7 +67,7 @@ pub fn run(
|
||||
"--watch",
|
||||
"-fincremental",
|
||||
"--debounce",
|
||||
"500",
|
||||
"500", // FIXME
|
||||
util.environmentBuildOption(main_options.options.environment),
|
||||
"-Djetzig_runner=true",
|
||||
});
|
||||
@ -93,6 +93,13 @@ pub fn run(
|
||||
std.process.exit(1);
|
||||
};
|
||||
|
||||
var zmpl_thread = try std.Thread.spawn(
|
||||
.{ .allocator = allocator },
|
||||
zmplThread,
|
||||
.{ allocator, cwd },
|
||||
);
|
||||
defer zmpl_thread.join();
|
||||
|
||||
while (true) {
|
||||
exe_path = try util.locateExecutable(allocator, cwd, .{});
|
||||
|
||||
@ -122,9 +129,6 @@ pub fn run(
|
||||
std.process.exit(term.Exited);
|
||||
}
|
||||
|
||||
// HACK: This currenly doesn't restart the server when it exits, maybe that
|
||||
// could be implemented in the future.
|
||||
|
||||
try awaitFileChange(exe_path.?, &mtime);
|
||||
std.debug.print("Changes detected, restarting server...\n", .{});
|
||||
_ = try process.kill();
|
||||
@ -142,12 +146,29 @@ fn awaitFileChange(path: []const u8, mtime: *i128) !void {
|
||||
}
|
||||
}
|
||||
|
||||
fn totalMtime(allocator: std.mem.Allocator, cwd: std.fs.Dir, sub_path: []const u8) !i128 {
|
||||
// var dir = try cwd.openDir(sub_path, .{ .iterate = true });
|
||||
// defer dir.close();
|
||||
_ = sub_path;
|
||||
fn zmplThread(allocator: std.mem.Allocator, cwd: std.fs.Dir) void {
|
||||
while (true) {
|
||||
awaitDirChange(allocator, cwd, "src/app/views") catch break;
|
||||
util.runCommand(allocator, &.{ "zig", "build", "compile" }) catch break;
|
||||
}
|
||||
}
|
||||
|
||||
var walker = try cwd.walk(allocator);
|
||||
fn awaitDirChange(allocator: std.mem.Allocator, dir: std.fs.Dir, sub_path: []const u8) !void {
|
||||
const mtime = try totalMtime(allocator, dir, sub_path);
|
||||
while (true) {
|
||||
std.time.sleep(watch_changes_pause_duration);
|
||||
const new_mtime = try totalMtime(allocator, dir, sub_path);
|
||||
if (new_mtime > mtime) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn totalMtime(allocator: std.mem.Allocator, cwd: std.fs.Dir, sub_path: []const u8) !i128 {
|
||||
var dir = try cwd.openDir(sub_path, .{ .iterate = true });
|
||||
defer dir.close();
|
||||
|
||||
var walker = try dir.walk(allocator);
|
||||
defer walker.deinit();
|
||||
|
||||
var sum: i128 = 0;
|
||||
@ -157,7 +178,7 @@ fn totalMtime(allocator: std.mem.Allocator, cwd: std.fs.Dir, sub_path: []const u
|
||||
// const extension = std.fs.path.extension(entry.path);
|
||||
|
||||
// if (std.mem.eql(u8, extension, ".zig") or std.mem.eql(u8, extension, ".zmpl")) {
|
||||
const stat = try cwd.statFile(entry.path);
|
||||
const stat = try dir.statFile(entry.path);
|
||||
sum += stat.mtime;
|
||||
// }
|
||||
}
|
||||
|
@ -12,9 +12,8 @@ pub fn index(request: *jetzig.Request, data: *jetzig.Data) !jetzig.View {
|
||||
try root.put("imported_number", importedFunction(100, 200, 300));
|
||||
|
||||
try request.response.headers.append("x-example-header", "example header value");
|
||||
try root.put("foobar", "helloooo what");
|
||||
try request.server.logger.INFO("hello yx", .{});
|
||||
std.debug.print("hello\n", .{});
|
||||
try root.put("foobar", "bloop");
|
||||
try request.server.logger.INFO("onnnnnnnnnne time", .{});
|
||||
|
||||
return request.render(.ok);
|
||||
}
|
||||
|
@ -6,17 +6,6 @@
|
||||
<!-- Renders `src/app/views/root/_quotes.zmpl`: -->
|
||||
<div>
|
||||
@partial root/quotes(message: .message)
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
<h1>a thing</h1>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
521
demo/src/routes.zig
Normal file
521
demo/src/routes.zig
Normal file
@ -0,0 +1,521 @@
|
||||
const jetzig = @import("jetzig");
|
||||
|
||||
pub const routes = [_]jetzig.Route{
|
||||
.{
|
||||
.id = "uJZa72JiFvkhip6kHN54byQl58IGiMjg",
|
||||
.name = "nested_route_example_get",
|
||||
.action = .get,
|
||||
.view_name = "nested/route/example",
|
||||
.view = jetzig.Route.View{ .with_id = @import("app/views/nested/route/example.zig").get },
|
||||
.path = "app/views/nested/route/example.zig",
|
||||
.static = false,
|
||||
.uri_path = "/nested/route/example",
|
||||
.template = "nested/route/example/get",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/nested/route/example.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/nested/route/example.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/nested/route/example.zig"), "layout")) @import("app/views/nested/route/example.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { "{\"id\":\"foo\",\"params\":{\"foo\":\"bar\"}}",
|
||||
"{\"id\":\"foo\"}" },
|
||||
.formats = if (@hasDecl(@import("app/views/nested/route/example.zig"), "formats")) @import("app/views/nested/route/example.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "BJYamvRbwEjmaARk364a4J5acl4wgL9U",
|
||||
.name = "static_get",
|
||||
.action = .get,
|
||||
.view_name = "static",
|
||||
.view = jetzig.Route.View{ .legacy_with_id = @import("app/views/static.zig").get },
|
||||
.path = "app/views/static.zig",
|
||||
.static = false,
|
||||
.uri_path = "/static",
|
||||
.template = "static/get",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/static.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/static.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/static.zig"), "layout")) @import("app/views/static.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { "{\"id\":\"123\",\"params\":{\"foo\":\"hi\",\"bar\":\"bye\"}}",
|
||||
"{\"id\":\"456\",\"params\":{\"foo\":\"hello\",\"bar\":\"goodbye\"}}" },
|
||||
.formats = if (@hasDecl(@import("app/views/static.zig"), "formats")) @import("app/views/static.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "RGSs0mSc6wzyetJerCDc7RfsQuc6duGG",
|
||||
.name = "static_index",
|
||||
.action = .index,
|
||||
.view_name = "static",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/static.zig").index },
|
||||
.path = "app/views/static.zig",
|
||||
.static = false,
|
||||
.uri_path = "/static",
|
||||
.template = "static/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/static.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/static.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/static.zig"), "layout")) @import("app/views/static.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { "{\"params\":{\"foo\":\"hi\",\"bar\":\"bye\"}}",
|
||||
"{\"params\":{\"foo\":\"hello\",\"bar\":\"goodbye\"}}" },
|
||||
.formats = if (@hasDecl(@import("app/views/static.zig"), "formats")) @import("app/views/static.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "vpO4u26CpMoJmbRrjopPW8ZdaFB9MOp4",
|
||||
.name = "session_edit",
|
||||
.action = .edit,
|
||||
.view_name = "session",
|
||||
.view = jetzig.Route.View{ .with_id = @import("app/views/session.zig").edit },
|
||||
.path = "app/views/session.zig",
|
||||
.static = false,
|
||||
.uri_path = "/session/edit",
|
||||
.template = "session/edit",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/session.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/session.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/session.zig"), "layout")) @import("app/views/session.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/session.zig"), "formats")) @import("app/views/session.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "WLr5eEhAkDE1nstNJSNFQRmIAmT1nmD2",
|
||||
.name = "root_edit",
|
||||
.action = .edit,
|
||||
.view_name = "root",
|
||||
.view = jetzig.Route.View{ .with_id = @import("app/views/root.zig").edit },
|
||||
.path = "app/views/root.zig",
|
||||
.static = false,
|
||||
.uri_path = "/edit",
|
||||
.template = "root/edit",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/root.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/root.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/root.zig"), "layout")) @import("app/views/root.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/root.zig"), "formats")) @import("app/views/root.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "nTbGohWH3dpErID5WA9oEFNy3mzZ4Zwa",
|
||||
.name = "format_get",
|
||||
.action = .get,
|
||||
.view_name = "format",
|
||||
.view = jetzig.Route.View{ .legacy_with_id = @import("app/views/format.zig").get },
|
||||
.path = "app/views/format.zig",
|
||||
.static = false,
|
||||
.uri_path = "/format",
|
||||
.template = "format/get",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/format.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/format.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/format.zig"), "layout")) @import("app/views/format.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/format.zig"), "formats")) @import("app/views/format.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "nsfHVzgASes8StjDJGb3n5M6lzPEZJgV",
|
||||
.name = "quotes_get",
|
||||
.action = .get,
|
||||
.view_name = "quotes",
|
||||
.view = jetzig.Route.View{ .legacy_with_id = @import("app/views/quotes.zig").get },
|
||||
.path = "app/views/quotes.zig",
|
||||
.static = false,
|
||||
.uri_path = "/quotes",
|
||||
.template = "quotes/get",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/quotes.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/quotes.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/quotes.zig"), "layout")) @import("app/views/quotes.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/quotes.zig"), "formats")) @import("app/views/quotes.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "CJt9JGk6xH2DdO6jCuBbPOpuQiiVx9AA",
|
||||
.name = "background_jobs_index",
|
||||
.action = .index,
|
||||
.view_name = "background_jobs",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/background_jobs.zig").index },
|
||||
.path = "app/views/background_jobs.zig",
|
||||
.static = false,
|
||||
.uri_path = "/background_jobs",
|
||||
.template = "background_jobs/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/background_jobs.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/background_jobs.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/background_jobs.zig"), "layout")) @import("app/views/background_jobs.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/background_jobs.zig"), "formats")) @import("app/views/background_jobs.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "njFQ9UNch4wUVakZwdVxoMrSctM3IFNn",
|
||||
.name = "session_index",
|
||||
.action = .index,
|
||||
.view_name = "session",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/session.zig").index },
|
||||
.path = "app/views/session.zig",
|
||||
.static = false,
|
||||
.uri_path = "/session",
|
||||
.template = "session/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/session.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/session.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/session.zig"), "layout")) @import("app/views/session.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/session.zig"), "formats")) @import("app/views/session.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "PjdQ8E8IsquUk6n4o5YjROnMf3ryhqTg",
|
||||
.name = "root_index",
|
||||
.action = .index,
|
||||
.view_name = "root",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/root.zig").index },
|
||||
.path = "app/views/root.zig",
|
||||
.static = false,
|
||||
.uri_path = "/",
|
||||
.template = "root/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/root.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/root.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/root.zig"), "layout")) @import("app/views/root.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/root.zig"), "formats")) @import("app/views/root.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "xsrBSO4IcVWr3hPniSteLZjLQPvHb01z",
|
||||
.name = "redirect_index",
|
||||
.action = .index,
|
||||
.view_name = "redirect",
|
||||
.view = jetzig.Route.View{ .without_id = @import("app/views/redirect.zig").index },
|
||||
.path = "app/views/redirect.zig",
|
||||
.static = false,
|
||||
.uri_path = "/redirect",
|
||||
.template = "redirect/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/redirect.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/redirect.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/redirect.zig"), "layout")) @import("app/views/redirect.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/redirect.zig"), "formats")) @import("app/views/redirect.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "pof2071a8lxXm2bOtGqa3kB9jIlFfZMK",
|
||||
.name = "format_index",
|
||||
.action = .index,
|
||||
.view_name = "format",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/format.zig").index },
|
||||
.path = "app/views/format.zig",
|
||||
.static = false,
|
||||
.uri_path = "/format",
|
||||
.template = "format/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/format.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/format.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/format.zig"), "layout")) @import("app/views/format.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/format.zig"), "formats")) @import("app/views/format.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "tLbQDcOUJgWFbj6V9gj8qpQKplSUPQRf",
|
||||
.name = "nested_route_example_index",
|
||||
.action = .index,
|
||||
.view_name = "nested/route/example",
|
||||
.view = jetzig.Route.View{ .without_id = @import("app/views/nested/route/example.zig").index },
|
||||
.path = "app/views/nested/route/example.zig",
|
||||
.static = false,
|
||||
.uri_path = "/nested/route/example",
|
||||
.template = "nested/route/example/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/nested/route/example.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/nested/route/example.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/nested/route/example.zig"), "layout")) @import("app/views/nested/route/example.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/nested/route/example.zig"), "formats")) @import("app/views/nested/route/example.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "TtBC947UM5h5jvT6tt3szPhx7PqUsXbH",
|
||||
.name = "mail_index",
|
||||
.action = .index,
|
||||
.view_name = "mail",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/mail.zig").index },
|
||||
.path = "app/views/mail.zig",
|
||||
.static = false,
|
||||
.uri_path = "/mail",
|
||||
.template = "mail/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/mail.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/mail.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/mail.zig"), "layout")) @import("app/views/mail.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/mail.zig"), "formats")) @import("app/views/mail.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "hFrag31RMb9yLcCO60iUEXQB3GCgGYym",
|
||||
.name = "anti_csrf_index",
|
||||
.action = .index,
|
||||
.view_name = "anti_csrf",
|
||||
.view = jetzig.Route.View{ .without_id = @import("app/views/anti_csrf.zig").index },
|
||||
.path = "app/views/anti_csrf.zig",
|
||||
.static = false,
|
||||
.uri_path = "/anti_csrf",
|
||||
.template = "anti_csrf/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/anti_csrf.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/anti_csrf.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/anti_csrf.zig"), "layout")) @import("app/views/anti_csrf.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/anti_csrf.zig"), "formats")) @import("app/views/anti_csrf.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "egmj9YOQlALfBOJ9BfmLC3wYN0ONAb4F",
|
||||
.name = "markdown_index",
|
||||
.action = .index,
|
||||
.view_name = "markdown",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/markdown.zig").index },
|
||||
.path = "app/views/markdown.zig",
|
||||
.static = false,
|
||||
.uri_path = "/markdown",
|
||||
.template = "markdown/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/markdown.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/markdown.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/markdown.zig"), "layout")) @import("app/views/markdown.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/markdown.zig"), "formats")) @import("app/views/markdown.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "RVYWSz1PQLbhF3yFwOznmbxkUM6rHrsS",
|
||||
.name = "init_index",
|
||||
.action = .index,
|
||||
.view_name = "init",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/init.zig").index },
|
||||
.path = "app/views/init.zig",
|
||||
.static = false,
|
||||
.uri_path = "/init",
|
||||
.template = "init/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/init.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/init.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/init.zig"), "layout")) @import("app/views/init.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/init.zig"), "formats")) @import("app/views/init.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "XcceAbNvt2vQqiJebTUjIM5W65NNhmEZ",
|
||||
.name = "kvstore_index",
|
||||
.action = .index,
|
||||
.view_name = "kvstore",
|
||||
.view = jetzig.Route.View{ .without_id = @import("app/views/kvstore.zig").index },
|
||||
.path = "app/views/kvstore.zig",
|
||||
.static = false,
|
||||
.uri_path = "/kvstore",
|
||||
.template = "kvstore/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/kvstore.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/kvstore.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/kvstore.zig"), "layout")) @import("app/views/kvstore.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/kvstore.zig"), "formats")) @import("app/views/kvstore.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "vWuB0hRyAG60CdbENpFX4k8wXyWWF3Bg",
|
||||
.name = "render_template_index",
|
||||
.action = .index,
|
||||
.view_name = "render_template",
|
||||
.view = jetzig.Route.View{ .without_id = @import("app/views/render_template.zig").index },
|
||||
.path = "app/views/render_template.zig",
|
||||
.static = false,
|
||||
.uri_path = "/render_template",
|
||||
.template = "render_template/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/render_template.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/render_template.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/render_template.zig"), "layout")) @import("app/views/render_template.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/render_template.zig"), "formats")) @import("app/views/render_template.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "elUHJfKyuvlfSY89JF25ZivCR9toimDd",
|
||||
.name = "cache_index",
|
||||
.action = .index,
|
||||
.view_name = "cache",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/cache.zig").index },
|
||||
.path = "app/views/cache.zig",
|
||||
.static = false,
|
||||
.uri_path = "/cache",
|
||||
.template = "cache/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/cache.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/cache.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/cache.zig"), "layout")) @import("app/views/cache.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/cache.zig"), "formats")) @import("app/views/cache.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "XDNbJRI6TcHFElLRQSXDHf4mzNDkGIq1",
|
||||
.name = "basic_index",
|
||||
.action = .index,
|
||||
.view_name = "basic",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/basic.zig").index },
|
||||
.path = "app/views/basic.zig",
|
||||
.static = false,
|
||||
.uri_path = "/basic",
|
||||
.template = "basic/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/basic.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/basic.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/basic.zig"), "layout")) @import("app/views/basic.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/basic.zig"), "formats")) @import("app/views/basic.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "yLZD4YD5XbulEEI6qVizoU8NA1opn0og",
|
||||
.name = "errors_index",
|
||||
.action = .index,
|
||||
.view_name = "errors",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/errors.zig").index },
|
||||
.path = "app/views/errors.zig",
|
||||
.static = false,
|
||||
.uri_path = "/errors",
|
||||
.template = "errors/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/errors.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/errors.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/errors.zig"), "layout")) @import("app/views/errors.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/errors.zig"), "formats")) @import("app/views/errors.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "rvrgBu8dueznrruGigCIEDlgUcKS0vfU",
|
||||
.name = "file_upload_index",
|
||||
.action = .index,
|
||||
.view_name = "file_upload",
|
||||
.view = jetzig.Route.View{ .without_id = @import("app/views/file_upload.zig").index },
|
||||
.path = "app/views/file_upload.zig",
|
||||
.static = false,
|
||||
.uri_path = "/file_upload",
|
||||
.template = "file_upload/index",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/file_upload.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/file_upload.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/file_upload.zig"), "layout")) @import("app/views/file_upload.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/file_upload.zig"), "formats")) @import("app/views/file_upload.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "rRo4FRbAB69Sup52MThXb6JgZeslwyd4",
|
||||
.name = "quotes_post",
|
||||
.action = .post,
|
||||
.view_name = "quotes",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/quotes.zig").post },
|
||||
.path = "app/views/quotes.zig",
|
||||
.static = false,
|
||||
.uri_path = "/quotes",
|
||||
.template = "quotes/post",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/quotes.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/quotes.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/quotes.zig"), "layout")) @import("app/views/quotes.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/quotes.zig"), "formats")) @import("app/views/quotes.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "XlCspoWCrkCb0Ita7IVboLu8IszoudGU",
|
||||
.name = "anti_csrf_post",
|
||||
.action = .post,
|
||||
.view_name = "anti_csrf",
|
||||
.view = jetzig.Route.View{ .without_id = @import("app/views/anti_csrf.zig").post },
|
||||
.path = "app/views/anti_csrf.zig",
|
||||
.static = false,
|
||||
.uri_path = "/anti_csrf",
|
||||
.template = "anti_csrf/post",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/anti_csrf.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/anti_csrf.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/anti_csrf.zig"), "layout")) @import("app/views/anti_csrf.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/anti_csrf.zig"), "formats")) @import("app/views/anti_csrf.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "ARjHlYPMqzO5sRAXRKAC5LEXnLRRlrx0",
|
||||
.name = "session_post",
|
||||
.action = .post,
|
||||
.view_name = "session",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/session.zig").post },
|
||||
.path = "app/views/session.zig",
|
||||
.static = false,
|
||||
.uri_path = "/session",
|
||||
.template = "session/post",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/session.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/session.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/session.zig"), "layout")) @import("app/views/session.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/session.zig"), "formats")) @import("app/views/session.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "pKQJ0IwnjtDChL7IWQ2nNhsbtPFs2o5j",
|
||||
.name = "cache_post",
|
||||
.action = .post,
|
||||
.view_name = "cache",
|
||||
.view = jetzig.Route.View{ .legacy_without_id = @import("app/views/cache.zig").post },
|
||||
.path = "app/views/cache.zig",
|
||||
.static = false,
|
||||
.uri_path = "/cache",
|
||||
.template = "cache/post",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/cache.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/cache.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/cache.zig"), "layout")) @import("app/views/cache.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/cache.zig"), "formats")) @import("app/views/cache.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "OebrtE1AyytRrnk8r2HKWVlzG41djdbl",
|
||||
.name = "params_post",
|
||||
.action = .post,
|
||||
.view_name = "params",
|
||||
.view = jetzig.Route.View{ .without_id = @import("app/views/params.zig").post },
|
||||
.path = "app/views/params.zig",
|
||||
.static = false,
|
||||
.uri_path = "/params",
|
||||
.template = "params/post",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/params.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/params.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/params.zig"), "layout")) @import("app/views/params.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/params.zig"), "formats")) @import("app/views/params.zig").formats else null,
|
||||
},
|
||||
.{
|
||||
.id = "kvOFWC1wJvT1vjYM3KyNUh6JsVyY5RVF",
|
||||
.name = "file_upload_post",
|
||||
.action = .post,
|
||||
.view_name = "file_upload",
|
||||
.view = jetzig.Route.View{ .without_id = @import("app/views/file_upload.zig").post },
|
||||
.path = "app/views/file_upload.zig",
|
||||
.static = false,
|
||||
.uri_path = "/file_upload",
|
||||
.template = "file_upload/post",
|
||||
.before_callbacks = jetzig.callbacks.beforeCallbacks(@import("app/views/file_upload.zig")),
|
||||
.after_callbacks = jetzig.callbacks.afterCallbacks(@import("app/views/file_upload.zig")),
|
||||
.layout = if (@hasDecl(@import("app/views/file_upload.zig"), "layout")) @import("app/views/file_upload.zig").layout else null,
|
||||
.json_params = &[_][]const u8 { },
|
||||
.formats = if (@hasDecl(@import("app/views/file_upload.zig"), "formats")) @import("app/views/file_upload.zig").formats else null,
|
||||
},
|
||||
};
|
||||
|
||||
pub const mailers = [_]jetzig.MailerDefinition{
|
||||
.{
|
||||
.name = "welcome",
|
||||
.deliverFn = @import("app/mailers/welcome.zig").deliver,
|
||||
.defaults = if (@hasDecl(@import("app/mailers/welcome.zig"), "defaults")) @import("app/mailers/welcome.zig").defaults else null,
|
||||
.html_template = "welcome/html",
|
||||
.text_template = "welcome/text",
|
||||
},
|
||||
};
|
||||
|
||||
pub const jobs = [_]jetzig.JobDefinition{
|
||||
.{ .name = "__jetzig_mail", .runFn = jetzig.mail.Job.run },
|
||||
.{
|
||||
.name = "example",
|
||||
.runFn = @import("app/jobs/example.zig").run,
|
||||
},
|
||||
};
|
||||
test {
|
||||
_ = @import("app/views/nested/route/example.zig");
|
||||
_ = @import("app/views/static.zig");
|
||||
_ = @import("app/views/static.zig");
|
||||
_ = @import("app/views/session.zig");
|
||||
_ = @import("app/views/root.zig");
|
||||
_ = @import("app/views/format.zig");
|
||||
_ = @import("app/views/quotes.zig");
|
||||
_ = @import("app/views/background_jobs.zig");
|
||||
_ = @import("app/views/session.zig");
|
||||
_ = @import("app/views/root.zig");
|
||||
_ = @import("app/views/redirect.zig");
|
||||
_ = @import("app/views/format.zig");
|
||||
_ = @import("app/views/nested/route/example.zig");
|
||||
_ = @import("app/views/mail.zig");
|
||||
_ = @import("app/views/anti_csrf.zig");
|
||||
_ = @import("app/views/markdown.zig");
|
||||
_ = @import("app/views/init.zig");
|
||||
_ = @import("app/views/kvstore.zig");
|
||||
_ = @import("app/views/render_template.zig");
|
||||
_ = @import("app/views/cache.zig");
|
||||
_ = @import("app/views/basic.zig");
|
||||
_ = @import("app/views/errors.zig");
|
||||
_ = @import("app/views/file_upload.zig");
|
||||
_ = @import("app/views/quotes.zig");
|
||||
_ = @import("app/views/anti_csrf.zig");
|
||||
_ = @import("app/views/session.zig");
|
||||
_ = @import("app/views/cache.zig");
|
||||
_ = @import("app/views/params.zig");
|
||||
_ = @import("app/views/file_upload.zig");
|
||||
@import("std").testing.refAllDeclsRecursive(@This());
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user