aboutsummaryrefslogtreecommitdiff
path: root/src/api/hello-json.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/hello-json.zig')
-rw-r--r--src/api/hello-json.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/api/hello-json.zig b/src/api/hello-json.zig
new file mode 100644
index 0000000..7c96c29
--- /dev/null
+++ b/src/api/hello-json.zig
@@ -0,0 +1,15 @@
+const http = @import("http");
+const Context = http.handler.Context;
+const Response = http.Response;
+
+const Ctx = Context(.{ "hello-json" });
+pub const ctx: Ctx = .{
+ .get = get,
+};
+
+fn get(request: Ctx.Request) Response {
+ return .ok_or_error(.json(request.arena, .{
+ .value = 42,
+ .message = "Hello, Json!",
+ }));
+}