mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-13 16:09:00 +08:00
7bed7ff482
Comments in headers are changed a bit: removed adoc-specific stuff, markdown is used instead PUBLISHED_FROM=9242cce85cc52a47a197d377e7e23804721a6bb5
29 lines
645 B
Markdown
29 lines
645 B
Markdown
---
|
|
title: "mg_serve_http()"
|
|
decl_name: "mg_serve_http"
|
|
symbol_kind: "func"
|
|
signature: |
|
|
void mg_serve_http(struct mg_connection *nc, struct http_message *hm,
|
|
struct mg_serve_http_opts opts);
|
|
---
|
|
|
|
Serve given HTTP request according to the `options`.
|
|
|
|
Example code snippet:
|
|
|
|
```c
|
|
static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|
struct http_message *hm = (struct http_message *) ev_data;
|
|
struct mg_serve_http_opts opts = { .document_root = "/var/www" }; // C99
|
|
|
|
switch (ev) {
|
|
case MG_EV_HTTP_REQUEST:
|
|
mg_serve_http(nc, hm, opts);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
```
|
|
|