aboutsummaryrefslogtreecommitdiff
path: root/src/api/hello-json.zig
blob: 6c29ba7a2c3d55e933b740d6b6654c401776df6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 .okOrError(.json(request.arena, .{
        .value = 42,
        .message = "Hello, Json!",
    }));
}