Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const std = @import("std");
- const web = @import("./zhp/src/zhp.zig");
- pub const io_mode = .evented;
- pub const log_level = .info;
- const MainHandler = struct {
- pub fn get(self: *MainHandler, request: *web.Request, response: *web.Response) !void {
- _ = try response.stream.write("HelloWorld!");
- }
- };
- pub const routes = [_]web.Route{
- web.Route.create("home", "/", MainHandler),
- };
- pub fn main() anyerror!void {
- var allocator = std.heap.raw_c_allocator;
- var app = web.Application.init(allocator, .{ .debug = false });
- defer app.deinit();
- try app.listen("127.0.0.1", 9000);
- try app.start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement