diff options
author | Michael McVady <femtonaut@gmail.com> | 2021-08-19 21:14:12 -0500 |
---|---|---|
committer | Michael McVady <femtonaut@gmail.com> | 2021-08-21 17:22:40 -0500 |
commit | f44dddb3be440af05abbe5d683c797f21d95eb00 (patch) | |
tree | 98b09c200182971da92f010313c991075d88423b /src | |
parent | 1d63cf7cbf413ec294f0c54816cd939bce06bb87 (diff) |
Working with assets
Diffstat (limited to 'src')
-rw-r--r-- | src/clog.c | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -1,12 +1,22 @@ #include <kore/kore.h> #include <kore/http.h> -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); } |