المشاريع
حول
Zinc is a web framework written in pure Zig with a focus on high performance, usability, security, and extensibility.
تطوير الويب والتطبيقاتما يمكنك فعله
- Asynchronous I/O via aio (Linux io_uring, macOS kqueue, Windows IOCP planned)
- Multithreaded worker pool
- Routing with nested route groups
- Global and route-level middleware
النمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- ٠
- خلال 15 يومًا
- +١
- خلال شهر
- +١
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلzinc
Zinc is a web framework written in pure Zig with a focus on usability, security, and extensibility, built on aio for asynchronous I/O.
:construction: It's still in active development. Not the fastest zig framework in the universe, but fast enough.
Features
- Asynchronous I/O via aio (Linux
io_uring, macOSkqueue, WindowsIOCPplanned) - Multithreaded worker pool
- Routing with nested route groups
- Global and route-level middleware
- Static file and directory serving
- Built-in template rendering
Installation
Add zinc to your build.zig.zon:
zig fetch --save https://github.com/zon-dev/zinc/archive/refs/heads/main.zip
Quick Start
const zinc = @import("zinc");
pub fn main() !void {
var z = try zinc.init(.{
.port = 8080,
});
defer z.deinit();
var router = z.getRouter();
try router.get("/", helloWorld);
try z.run();
}
fn helloWorld(ctx: *zinc.Context) anyerror!void {
try ctx.text("Hello world!", .{});
}
Usage
Route Groups
var router = z.getRouter();
var api = try router.group("/api");
try api.get("/users", getUsers);
try api.post("/users", createUser);
var v1 = try api.group("/v1");
try v1.get("/status", getStatus);
Middleware
// Global middleware
try router.use(&.{authMiddleware, corsMiddleware});
// Route-specific middleware
try router.get("/protected", protectedHandler);
Static Files
// Serve a single file
try router.staticFile("/favicon.ico", "public/favicon.ico");
// Serve a directory
try router.staticDir("/assets", "public/assets");
Documentation
🧪 Testing
Run the comprehensive test suite:
zig build test
All tests pass with zero memory leaks and full async I/O coverage.
📚 Documentation
- API Reference: https://zinc.zon.dev/
- Quick Start Guide: https://zinc.zon.dev/src/quickstart.html
🔧 Development
git clone https://github.com/zon-dev/zinc.git
cd zinc
zig build test
License
MIT. See LICENSE for details.
🙏 Acknowledgments
- aio library: For providing excellent cross-platform async I/O
- Contributors: Everyone who has helped make zinc better
:star: Star this repository if you find it useful!
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…