mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 15:14:08 +00:00
28 lines
916 B
Zig
28 lines
916 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 StopEndpoint = @This();
|
|
|
|
path: []const u8,
|
|
error_strategy: zap.Endpoint.ErrorStrategy = .log_to_response,
|
|
|
|
pub fn init(path: []const u8) StopEndpoint {
|
|
return .{
|
|
.path = path,
|
|
};
|
|
}
|
|
|
|
pub fn get(_: *StopEndpoint, _: zap.Request) !void {
|
|
zap.stop();
|
|
}
|
|
|
|
// not implemented:
|
|
pub fn custom_method(_: *StopEndpoint, _: zap.Request) !void {}
|
|
pub fn delete(_: *StopEndpoint, _: zap.Request) !void {}
|
|
pub fn head(_: *StopEndpoint, _: zap.Request) !void {}
|
|
pub fn options(_: *StopEndpoint, _: zap.Request) !void {}
|
|
pub fn patch(_: *StopEndpoint, _: zap.Request) !void {}
|
|
pub fn post(_: *StopEndpoint, _: zap.Request) !void {}
|
|
pub fn put(_: *StopEndpoint, _: zap.Request) !void {}
|