Skip to content

Commit

Permalink
add embedFile()
Browse files Browse the repository at this point in the history
  • Loading branch information
cztomsik committed Feb 3, 2024
1 parent 306cc51 commit c54cfcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
},

.tokamak = .{
.url = "https://github.com/cztomsik/tokamak/archive/b173be5.tar.gz",
.hash = "1220eeb2ce65750c676b5a4a7c577c892de25c3aaa57daff777f97d1a1228625e3bb",
.url = "https://github.com/cztomsik/tokamak/archive/0c0f497.tar.gz",
.hash = "12208a5a60968d23f05140b2debe2afe7346e1048f3cb8c6a5be1872ad5a6d15f585",
},
},
.paths = .{
Expand Down
4 changes: 4 additions & 0 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ pub const std_options = struct {
pub const logFn = util.Logger.log;
};

pub fn embedFile(comptime path: []const u8) []const u8 {
return @embedFile("../" ++ path);
}

fn handler(injector: tk.Injector, uri: *std.Uri, r: *tk.Responder) anyerror!void {
// handle API requests
if (tk.Params.match("/api/*", uri.path)) |_| {
Expand Down

0 comments on commit c54cfcb

Please sign in to comment.