예제 #1
0
파일: status.c 프로젝트: jackey/Tofu
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);
}
예제 #2
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;
}
예제 #3
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;
}