Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zon-dev/zinc
Zinc is a high performance framework written in pure Zig. Zinc focuses on hight-performance, usability, security, and extensibility.
https://github.com/zon-dev/zinc
api framework performance resetful rest-api usability web web-development web-framework zig zig-package zig-zinc ziglang zinc
Last synced: about 1 month ago
JSON representation
Zinc is a high performance framework written in pure Zig. Zinc focuses on hight-performance, usability, security, and extensibility.
- Host: GitHub
- URL: https://github.com/zon-dev/zinc
- Owner: zon-dev
- License: mit
- Created: 2024-03-19T12:40:08.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-10T08:43:50.000Z (about 1 month ago)
- Last Synced: 2024-08-10T12:08:45.970Z (about 1 month ago)
- Topics: api, framework, performance, resetful, rest-api, usability, web, web-development, web-framework, zig, zig-package, zig-zinc, ziglang, zinc
- Language: Zig
- Homepage: https://zinc.zon.dev
- Size: 85.9 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zinc
----
Zinc is a high-performance web framework written in Zig(Ziglang).
### Usage.
```zig
const zinc = @import("zinc");pub fn main() !void {
var z = try zinc.init(.{ .port = 8080 });var router = z.getRouter();
try router.get("/", helloWorld);
try router.add(&.{ .GET, .POST }, "/ping", pong);var catchers = z.getCatchers();
try catchers.setNotFound(notFound);try z.run();
}fn pong(ctx: *zinc.Context, _: *zinc.Request, _: *zinc.Response) anyerror!void {
try ctx.Text(.{}, "pong!");
}fn helloWorld(ctx: *zinc.Context, _: *zinc.Request, _: *zinc.Response) anyerror!void {
try ctx.JSON(.{}, .{ .message = "Hello, World!" });
}// Default 404 (not found) page
fn notFound(ctx: *zinc.Context, _: *zinc.Request, _: *zinc.Response) anyerror!void {
try ctx.HTML(.{
.status = .not_found,
}, "404 Not Found
");
}```