mg_add_uri_handler -> mg_set_request_handler()

This commit is contained in:
Sergey Lyubka committed 2014-01-28 12:42:13 +00:00
1 parent a6cfbd2536
commit 14526a2109
12 files changed
+116 -120

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@
// This function will be called by mongoose on every new request
static int index_html(struct mg_connection *conn) {
mg_printf_data(conn, "Hello! Requested URI is [%s]", conn->uri);
return 1;
return MG_REQUEST_PROCESSED;
}
int main(void) {
@@ -14,7 +14,7 @@ int main(void) {
// Create and configure the server
server = mg_create_server(NULL);
mg_set_option(server, "listening_port", "8080");
mg_add_uri_handler(server, "/", index_html);
mg_set_request_handler(server, index_html);
// Serve request. Hit Ctrl-C to terminate the program
printf("Starting on port %s\n", mg_get_option(server, "listening_port"));