int main() { char *opts[] = { "0.0.0.0", "8080" }; tofu_ctx_t *ctx = tofu_ctx_init(TOFU_EVHTTP, opts); tofu_handle_with(ctx, GET, "/hi", hello); tofu_loop(ctx); return 0; }
void *tofu_start(void *arg) { tofu_ctx_t *ctx = tofu_ctx_init(TOFU_EVHTTP, tofu_opts); tofu_handle_with(ctx, POST, "/simple", post_simple, NULL); tofu_handle_with(ctx, POST, "/param/:param", post_param, NULL); tofu_handle_with(ctx, POST, "/multi/:par1/:par2", post_param_multi, NULL); tofu_handle_with(ctx, POST, "/multi/:par1/static/:par2", post_param_multi, NULL); tofu_loop(ctx); }
void *tofu_start(void *arg) { tofu_ctx_t *ctx = tofu_ctx_init(TOFU_EVHTTP, tofu_opts); tofu_handle_with(ctx, GET, "/coffe", status_simple, NULL); tofu_rescue_with(ctx, 418, error_418); tofu_rescue_with(ctx, 404, error_404); tofu_loop(ctx); }
int main() { char *opts[] = { "0.0.0.0", "2000" }; tofu_ctx_t *ctx = tofu_ctx_init(TOFU_EVHTTP, opts); tofu_handle_with(ctx, POST, "/post/:data", eg_handler); tofu_loop(ctx); tofu_ctx_free(ctx); return 0; }
int main() { char *opts[] = { "0.0.0.0", "2000" }; tofu_ctx_t *ctx = tofu_ctx_init(TOFU_EVHTTP, opts); tofu_handle_with(ctx, GET, "/coffee", handler, NULL); tofu_rescue_with(ctx, 418, error_418); tofu_loop(ctx); tofu_ctx_free(ctx); return 0; }
int main() { char *opts[] = { "0.0.0.0", "2000" }; tofu_ctx_t *ctx = tofu_ctx_init(TOFU_EVHTTP, opts); tofu_handle_with(ctx, GET, "/", handler_root); tofu_rescue_with(ctx, 404, handler_404); tofu_rescue_with(ctx, 500, handler_500); tofu_loop(ctx); tofu_ctx_free(ctx); return 0; }