aboutsummaryrefslogtreecommitdiff
path: root/examples/hello-world
diff options
context:
space:
mode:
authorfrosty <frosty@illegalfirearms.store>2025-12-28 03:26:05 -0500
committerfrosty <frosty@illegalfirearms.store>2025-12-28 03:26:05 -0500
commit4af132cf6adeeeeb5d6764c378bec2d05cad042f (patch)
treee422cff2831424775ba5c20196064f94cbe1e5c3 /examples/hello-world
Migrated from GitHub
Diffstat (limited to 'examples/hello-world')
-rw-r--r--examples/hello-world/Makefile6
-rw-r--r--examples/hello-world/main.c20
2 files changed, 26 insertions, 0 deletions
diff --git a/examples/hello-world/Makefile b/examples/hello-world/Makefile
new file mode 100644
index 0000000..56813e3
--- /dev/null
+++ b/examples/hello-world/Makefile
@@ -0,0 +1,6 @@
+CC = gcc
+
+hello-world:
+ $(CC) -o hello-world main.c -lbeaker
+clean:
+ rm hello-world \ No newline at end of file
diff --git a/examples/hello-world/main.c b/examples/hello-world/main.c
new file mode 100644
index 0000000..bf3c8b0
--- /dev/null
+++ b/examples/hello-world/main.c
@@ -0,0 +1,20 @@
+#include <beaker.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int hello_world_handler(UrlParams *params) {
+ send_response("Hello, World!");
+ return 0;
+}
+
+int main() {
+ set_handler("/", hello_world_handler);
+ int result = beaker_run("127.0.0.1", 8080);
+
+ if (result != 0) {
+ fprintf(stderr, "[APP] Error: Beaker server failed to start.\n");
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+}