aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/hi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/hi.c b/examples/hi.c
new file mode 100644
index 0000000..9305ad5
--- /dev/null
+++ b/examples/hi.c
@@ -0,0 +1,16 @@
+#include <magi.h>
+#include <stdio.h>
+
+int main()
+{
+ struct magi_request request;
+ magi_request_init(&request);
+ if (magi_parse(&request)) {
+ magi_response_default();
+ puts("<html><head><title>Hi!</title></head><body>Hi!</body></html>");
+ } else {
+ magi_error_response(request.error);
+ }
+ magi_request_free(&request);
+ return 0;
+}