Removed: random std.info.log's
This commit is contained in:
parent
80b93b7437
commit
d1fba53891
1 changed files with 0 additions and 8 deletions
|
@ -10,8 +10,6 @@ pub fn init(allocator: std.mem.Allocator) Self {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn index(self: *Self, req: zap.Request) void {
|
pub fn index(self: *Self, req: zap.Request) void {
|
||||||
std.log.warn("index", .{});
|
|
||||||
|
|
||||||
const string = std.fmt.allocPrint(
|
const string = std.fmt.allocPrint(
|
||||||
self.allocator,
|
self.allocator,
|
||||||
"Test",
|
"Test",
|
||||||
|
@ -22,8 +20,6 @@ pub fn index(self: *Self, req: zap.Request) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn home(self: *Self, req: zap.Request) void {
|
pub fn home(self: *Self, req: zap.Request) void {
|
||||||
std.log.warn("home", .{});
|
|
||||||
|
|
||||||
const string = std.fmt.allocPrint(
|
const string = std.fmt.allocPrint(
|
||||||
self.allocator,
|
self.allocator,
|
||||||
"HOME!!!",
|
"HOME!!!",
|
||||||
|
@ -38,11 +34,8 @@ pub fn blog(self: *Self, req: zap.Request) void {
|
||||||
std.log.err("parse error: {any}", .{err});
|
std.log.err("parse error: {any}", .{err});
|
||||||
};
|
};
|
||||||
req.parseQuery();
|
req.parseQuery();
|
||||||
const param_count = req.getParamCount();
|
|
||||||
std.log.info("param_count: {}", .{param_count});
|
|
||||||
// looking for /blog?post=post_name
|
// looking for /blog?post=post_name
|
||||||
if(req.getParamSlice("post")) |value| {
|
if(req.getParamSlice("post")) |value| {
|
||||||
std.log.info("post name: {s}", .{value});
|
|
||||||
// TODO: This will need to be updated to look at absolute
|
// TODO: This will need to be updated to look at absolute
|
||||||
// filepaths instead, it's a happy accident that this is safe now.
|
// filepaths instead, it's a happy accident that this is safe now.
|
||||||
const filepath = std.fmt.allocPrint(self.allocator, "./src/public/blog/{s}", .{value}) catch return;
|
const filepath = std.fmt.allocPrint(self.allocator, "./src/public/blog/{s}", .{value}) catch return;
|
||||||
|
@ -52,7 +45,6 @@ pub fn blog(self: *Self, req: zap.Request) void {
|
||||||
// I believe that this is safe, since now the post_name now has to be
|
// I believe that this is safe, since now the post_name now has to be
|
||||||
// equal to one of the entries within the specified directory
|
// equal to one of the entries within the specified directory
|
||||||
while (walker.next() catch return) |entry| {
|
while (walker.next() catch return) |entry| {
|
||||||
std.log.info("entry: {s}", .{entry.path});
|
|
||||||
if(std.mem.eql(u8,entry.path,value)) {
|
if(std.mem.eql(u8,entry.path,value)) {
|
||||||
const file_content = std.fs.cwd().readFileAlloc(self.allocator, filepath, std.math.maxInt(usize)) catch return;
|
const file_content = std.fs.cwd().readFileAlloc(self.allocator, filepath, std.math.maxInt(usize)) catch return;
|
||||||
defer self.allocator.free(file_content);
|
defer self.allocator.free(file_content);
|
||||||
|
|
Loading…
Reference in a new issue