ooyeku/engine12
A web framework for Zig
23a309d23016227a108e7e0a502ed0c11357832844a0a22d0ca4fe6886a5dc9f27b5149544f2387ec94d22bbce1f3c968c03145f6c303cd3a1cf0ad391ca9c501066144fa95a52237da110812e9aa145masterA backend framework for Zig, designed for building high-performance web applications and APIs.
Option 1: Use CLI Tool (Recommended)
# Create a new project with recommended structure
e12 new myapp
cd myapp
zig build run
Option 2: Manual Setup
const std = @import("std");
const Engine12 = @import("engine12");
fn handleRoot(req: *Engine12.Request) Engine12.Response {
_ = req;
return Engine12.Response.text("Hello, World!");
}
pub fn main() !void {
var app = try Engine12.initDevelopment();
defer app.deinit();
try app.get("/", handleRoot);
try app.listen(); // Blocks until shutdown
}
Run zig fetch to add Engine12 to your build.zig.zon:
zig fetch --save "git+https://github.com/ooyeku/engine12.git"
This will automatically add the dependency with the correct hash to your build.zig.zon file.
Alternatively, you can manually add it to your build.zig.zon:
.dependencies = .{
.engine12 = .{
.url = "git+https://github.com/ooyeku/engine12.git",
.hash = "...", // Run `zig fetch` to get the hash
},
},
Add the dependency and module to your build.zig:
const engine12_dep = b.dependency("engine12", .{
.target = target,
.optimize = optimize,
});
exe.addModule("engine12", engine12_dep.module("engine12"));
If you're using the ORM, you'll also need to link libc:
// Link libc (required for ORM/SQLite functionality)
exe.linkLibC();
configure()e12 new) to generate projects with recommended structureSee the todo app example for a complete working application demonstrating:
MIT License - see LICENSE file for details.
Contributions welcome! Please see our contributing guidelines.