Skip to content

dgrng/zig-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zig-lambda

experimental aws lambda runtime for ziglang (wip)

requires latest(master branch) zig compiler

example:

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    defer {
        if (gpa.deinit() == .leak) {
            @panic("leaked");
        }
    }
    const allocator = gpa.allocator();
    var runtime = Runtime.new(allocator, &handler);
    defer runtime.deinit();
    try runtime.start();
}

fn handler(allocator: Allocator, ctx: *const Context) anyerror!void {
    _ = allocator;
    std.log.info("body : {s}\n", .{ctx.event_payload});
    var res =
        \\ {
        \\ "message" : "ok",
        \\ "status" : 200
        \\ }
        \\
    ;
    try ctx.respond(res);
}

About

aws lambda runtime for zig (wip)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages