{"id":13611899,"url":"https://github.com/Vexu/routez","last_synced_at":"2025-04-13T05:33:46.841Z","repository":{"id":42792614,"uuid":"190880439","full_name":"Vexu/routez","owner":"Vexu","description":"Http server for Zig","archived":true,"fork":false,"pushed_at":"2023-02-06T11:23:03.000Z","size":175,"stargazers_count":248,"open_issues_count":3,"forks_count":8,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-26T08:32:05.611Z","etag":null,"topics":["http","server","zig"],"latest_commit_sha":null,"homepage":"https://routez.vexu.eu","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vexu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-08T11:33:41.000Z","updated_at":"2025-01-09T04:58:39.000Z","dependencies_parsed_at":"2024-05-03T07:59:39.006Z","dependency_job_id":"2ea807ac-7418-40c3-9968-8d5f2cdd80c3","html_url":"https://github.com/Vexu/routez","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexu%2Froutez","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexu%2Froutez/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexu%2Froutez/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexu%2Froutez/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vexu","download_url":"https://codeload.github.com/Vexu/routez/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670514,"owners_count":21142896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","server","zig"],"created_at":"2024-08-01T19:02:18.194Z","updated_at":"2025-04-13T05:33:46.406Z","avatar_url":"https://github.com/Vexu.png","language":"Zig","funding_links":[],"categories":["Zig","Libraries","Web","Network \u0026 Web"],"sub_categories":["Network"],"readme":"# Routez\nHTTP server for Zig.\n\n## Example\n### [basic](examples/basic.zig)\nRun with `zig build basic`\n```Zig\nconst std = @import(\"std\");\nconst Address = std.net.Address;\nusingnamespace @import(\"routez\");\nconst allocator = std.heap.page_allocator;\n\npub const io_mode = .evented;\n\npub fn main() !void {\n    var server = Server.init(\n        allocator,\n        .{},\n        .{\n            all(\"/\", indexHandler),\n            get(\"/about\", aboutHandler),\n            get(\"/about/more\", aboutHandler2),\n            get(\"/post/{post_num}/?\", postHandler),\n            static(\"./\", \"/static\"),\n            all(\"/counter\", counterHandler),\n        },\n    );\n    var addr = try Address.parseIp(\"127.0.0.1\", 8080);\n    try server.listen(addr);\n}\n\nfn indexHandler(req: Request, res: Response) !void {\n    try res.sendFile(\"examples/index.html\");\n}\n\nfn aboutHandler(req: Request, res: Response) !void {\n    try res.write(\"Hello from about\\n\");\n}\n\nfn aboutHandler2(req: Request, res: Response) !void {\n    try res.write(\"Hello from about2\\n\");\n}\n\nfn postHandler(req: Request, res: Response, args: *const struct {\n    post_num: []const u8,\n}) !void {\n    try res.print(\"Hello from post, post_num is {}\\n\", args.post_num);\n}\n\nvar counter = std.atomic.Int(usize).init(0);\nfn counterHandler(req: Request, res: Response) !void {\n    try res.print(\"Page loaded {} times\\n\", counter.fetchAdd(1));\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVexu%2Froutez","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVexu%2Froutez","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVexu%2Froutez/lists"}