aboutsummaryrefslogtreecommitdiff
path: root/src/api/hello-json.zig
blob: 12f1e72269091e96e41eb6f679529e21a13cd91c (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!",
    }));
}