int stop() { http_stop(); thread_pool_destroy(); rest_destroy(); jparse_destroy(); #ifdef _DEBUG billing_destroy(); #endif api_log_printf("[HTTP] Stopped\r\n"); return 0; }
void http_start(const char *web_root_, const char *doc_root_) { replace_str(&doc_root, doc_root_); replace_str(&web_root, web_root_); http_stop(); ctx = mg_start(); mg_set_option(ctx, "root", web_root); mg_set_option(ctx, "ports", http_port); mg_set_uri_callback(ctx, "/", &show_index, NULL); mg_set_uri_callback(ctx, "/eval", &eval_script, NULL); mg_set_uri_callback(ctx, "/get_files", &get_files, NULL); mg_set_uri_callback(ctx, "/open_file", &open_file, NULL); mg_set_uri_callback(ctx, "/upload_file", &upload_file, NULL); mg_set_uri_callback(ctx, "/upload_script", &upload_script, NULL); }