18 lines
396 B
Zig
18 lines
396 B
Zig
|
pub const http = @import("http");
|
||
|
|
||
|
pub const upload = struct {
|
||
|
pub const method = .POST;
|
||
|
pub const path = "/drive/:path*";
|
||
|
|
||
|
pub const Body = struct {
|
||
|
file: http.FormFile,
|
||
|
};
|
||
|
|
||
|
pub fn handler(req: anytype, res: anytype, srv: anytype) !void {
|
||
|
const f = req.body.file;
|
||
|
try srv.uploadFile(f.filename, f.data);
|
||
|
|
||
|
try res.json(.created, .{});
|
||
|
}
|
||
|
};
|