aboutsummaryrefslogtreecommitdiff
path: root/examples/hello-world/main.c
blob: bf3c8b080ef8c78956740e7fff281d4ea32a44a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
}