diff --git a/examples/file.c b/examples/file.c
index 568f7d67bcf270e4efda8668b99b61779cf8aac3..86e4a76811e2873b29144f1ddd6d56c18f356426 100644
--- a/examples/file.c
+++ b/examples/file.c
@@ -32,7 +32,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"));