mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-20 19:41:58 +00:00
Small nit in minimal HTTP server example
This commit is contained in:
1 parent
a113e344a1
commit
64ad15895f
1 file changed
+3
-3
+3
-3
@@ -377,10 +377,10 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|||||||
if (ev == MG_EV_HTTP_MSG) {
|
if (ev == MG_EV_HTTP_MSG) {
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
if (mg_http_match_uri(hm, "/api/hello")) {
|
if (mg_http_match_uri(hm, "/api/hello")) {
|
||||||
mg_http_reply(c, 200, "", "%s\n", "hi"); // Serve dynamic content
|
mg_http_reply(c, 200, "", "{%Q:%d}\n", "status", 1); // Dynamic JSON response
|
||||||
} else {
|
} else {
|
||||||
struct mg_http_serve_opts opts = {.root_dir = "."}; // Serve
|
struct mg_http_serve_opts opts = {.root_dir = "."}; // Serve static content
|
||||||
mg_http_serve_dir(c, ev_data, &opts); // static content
|
mg_http_serve_dir(c, hm, &opts); // Web UI from root_dir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user