1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00
zap/examples/endpoint/stopendpoint.zig
2025-03-16 04:45:31 +01:00

26 lines
666 B
Zig

const std = @import("std");
const zap = @import("zap");
/// A simple endpoint listening on the /stop route that shuts down zap
/// the main thread usually continues at the instructions after the call to zap.start().
pub const Self = @This();
path: []const u8,
pub fn init(path: []const u8) Self {
return .{
.path = path,
};
}
pub fn get(e: *Self, r: zap.Request) void {
_ = e;
_ = r;
zap.stop();
}
pub fn post(_: *Self, _: zap.Request) void {}
pub fn put(_: *Self, _: zap.Request) void {}
pub fn delete(_: *Self, _: zap.Request) void {}
pub fn patch(_: *Self, _: zap.Request) void {}
pub fn options(_: *Self, _: zap.Request) void {}