From f44dddb3be440af05abbe5d683c797f21d95eb00 Mon Sep 17 00:00:00 2001 From: Michael McVady Date: Thu, 19 Aug 2021 21:14:12 -0500 Subject: Working with assets --- src/clog.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/clog.c b/src/clog.c index 31efef8..74564f0 100644 --- a/src/clog.c +++ b/src/clog.c @@ -1,12 +1,22 @@ #include #include -int page(struct http_request *); +#include "assets.h" -int -page(struct http_request *req) +int page(struct http_request *); + +int page(struct http_request *req) { - char *resp_body = "clog lives!\r\n"; - http_response(req, 200, resp_body, strlen(resp_body)); + struct kore_buf *buf; + buf = kore_buf_alloc(); + + kore_buf_append(buf, asset_index_begin_html, asset_len_index_begin_html); + kore_buf_append(buf, asset_index_end_html, asset_len_index_end_html); + + http_response_header(req, "content-type", "text/html; charset=utf-8"); + http_response(req, 200, buf->data, buf->offset); + // http_response_stream ??? + kore_buf_free(buf); + return (KORE_RESULT_OK); } -- cgit v1.2.3