Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shiori_zig

Zig用のSHIORI/3.0パーサ

使用例

const std = @import("std");
const shiori = @import("shiori");

fn request(arena: std.mem.Allocator, body: []const u8) [:0]const u8 {
    var req = shiori.request.parse(arena, body) catch {
        const resp = shiori.response.Response{
            .status = .bad_request,
        };
        return resp.render(arena);
    };

    const value = std.fmt.allocPrint(arena, "\\0こんにちは、{s}ユーザーさん。\\e", .{ req.sender }) catch {
        return shiori.response.OOM_ERROR_RESPONSE;
    };

    const resp = shiori.response.Response{
        .status = .ok,
        .value = value,
    };
    return resp.render(arena);
}

関連

Contributors

Languages