From b1f2e3cd60026589efaa318827a640c15a21549a Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Thu, 21 Sep 2023 10:06:54 -0700 Subject: [PATCH] fully working example --- build.zig | 5 +++-- src/main.zig | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 7a90188..8bcd3b1 100644 --- a/build.zig +++ b/build.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const universal_lambda_build = @import("universal_lambda_build"); +const configureUniversalLambdaBuild = @import("universal_lambda_build").configureBuild; // Although this function looks imperative, note that its job is to // declaratively construct a build graph that will be executed by an external @@ -25,7 +25,8 @@ pub fn build(b: *std.Build) !void { .optimize = optimize, }); - try universal_lambda_build.configureBuild(b, exe); + // All modules should be added before this is called + try configureUniversalLambdaBuild(b, exe); // This declares intent for the executable to be installed into the // standard location when the user invokes the "install" step (the default diff --git a/src/main.zig b/src/main.zig index 942caef..70eb361 100644 --- a/src/main.zig +++ b/src/main.zig @@ -5,9 +5,9 @@ pub fn main() !void { try universal_lambda.run(null, handler); } -fn handler(allocator: std.mem.Allocator, event_data: []const u8, context: universal_lambda.Context) ![]const u8 { - _ = allocator; +pub fn handler(allocator: std.mem.Allocator, event_data: []const u8, context: universal_lambda.Context) ![]const u8 { _ = event_data; + _ = allocator; _ = context; return "hello world"; }