Update README

This commit is contained in:
2025-07-20 20:45:34 +02:00
parent 9df891b409
commit 8010e0ec1b
+4 -2
View File
@@ -37,6 +37,7 @@ And this is an HTTP server:
int main(void) int main(void)
{ {
http_global_init();
HTTP_Server *server = http_server_init(HTTP_STR("127.0.0.1"), 8080); HTTP_Server *server = http_server_init(HTTP_STR("127.0.0.1"), 8080);
for (;;) { for (;;) {
@@ -45,8 +46,8 @@ int main(void)
HTTP_ResponseHandle res; HTTP_ResponseHandle res;
http_server_wait(server, &res, &res); http_server_wait(server, &res, &res);
HTTP_String path = req->url.path; printf("requested path [%.*s]\n",
printf("requested path [%.*s]\n", HTTP_UNPACK(req->url.path)); HTTP_UNPACK(req->url.path));
http_response_status(res, 200); http_response_status(res, 200);
http_response_header(res, "Content-Type: text/plain"); http_response_header(res, "Content-Type: text/plain");
@@ -56,6 +57,7 @@ int main(void)
} }
http_server_free(server); http_server_free(server);
http_global_free();
return 0; return 0;
} }
``` ```