mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-08 16:11:18 +00:00
Remove old docs, rename docs_new to docs
It would be probably good idea to also remove tools/docgen.py and asciidoc.mk, but asciidoc.mk is still mentioned under `cloud/doc`, which may contain some useful info which we'll need at least to review before removing. PUBLISHED_FROM=faf454d4c52a2f07ea8ac084cf0bd11a0c9c9b3b
This commit is contained in:
1 parent
f443c64341
commit
23122b327c
182 files changed
+3592
-263
No files matched your search
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: "mg_register_http_endpoint()"
|
||||
decl_name: "mg_register_http_endpoint"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path,
|
||||
mg_event_handler_t handler);
|
||||
---
|
||||
|
||||
Register callback for specified http endpoint
|
||||
Note: if callback is registered it is called instead of
|
||||
callback provided in mg_bind
|
||||
|
||||
Example code snippet:
|
||||
|
||||
```c
|
||||
static void handle_hello1(struct mg_connection *nc, int ev, void *ev_data) {
|
||||
(void) ev; (void) ev_data;
|
||||
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello1]");
|
||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
}
|
||||
|
||||
static void handle_hello1(struct mg_connection *nc, int ev, void *ev_data) {
|
||||
(void) ev; (void) ev_data;
|
||||
mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n[I am Hello2]");
|
||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
}
|
||||
|
||||
void init() {
|
||||
nc = mg_bind(&mgr, local_addr, cb1);
|
||||
mg_register_http_endpoint(nc, "/hello1", handle_hello1);
|
||||
mg_register_http_endpoint(nc, "/hello1/hello2", handle_hello2);
|
||||
}
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user