### Basic Mongoose.jl HTTP Server Example Source: https://github.com/abrja/mongoose.jl/blob/main/docs/src/index.md A quick start example demonstrating how to set up a basic HTTP server in Julia using Mongoose.jl. It defines handlers for JSON and text responses, registers them for specific routes, and starts the server. ```julia using Mongoose function test_json(conn; kwargs...) mg_json_reply(conn, 200, "{\"message\":\"Hi JSON!\"}") end function test_text(conn; kwargs...) mg_text_reply(conn, 200, "Hi TEXT!") end mg_register!("GET", "/json", test_json) mg_register!("GET", "/text", test_text) mg_serve!() mg_shutdown!() ``` -------------------------------- ### Start Mongoose Server - Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/examples.html Starts the Mongoose web server. This function initiates the server process, making it ready to handle incoming requests. ```julia mg_serve!() ``` -------------------------------- ### Server Management Source: https://github.com/abrja/mongoose.jl/blob/main/docs/src/examples.md Functions to start and shut down the Mongoose server. ```APIDOC ## Server Management ### Start Server Starts the Mongoose server. ```julia mg_serve!() ``` ### End Server Shuts down the Mongoose server. ```julia mg_shutdown!() ``` ``` -------------------------------- ### GET /greet Endpoint Source: https://github.com/abrja/mongoose.jl/blob/main/docs/src/examples.md Handles GET requests to the /greet endpoint. It extracts a name from the query parameters and responds with a greeting. If no name is found, it greets an unknown person. ```APIDOC ## GET /greet ### Description Handles GET requests to the /greet endpoint. It extracts a name from the query parameters and responds with a greeting. If no name is found, it greets an unknown person. ### Method GET ### Endpoint /greet ### Parameters #### Query Parameters - **message** (string) - Required - Contains the request details, including query parameters. ### Request Example (No explicit request body for GET, but the `message` in `kwargs` would contain the query string) ### Response #### Success Response (200) - **body** (string) - A greeting message. #### Response Example ``` Hi John ``` ``` -------------------------------- ### Install Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/README.md Installs the Mongoose.jl package using the Julia package manager. ```julia ] add Mongoose ``` -------------------------------- ### Load Mongoose.jl Library Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/examples.html This snippet shows how to load the Mongoose.jl library using the 'using' keyword, making its functions available for use. ```julia using Mongoose ``` -------------------------------- ### Mongoose.mg_serve! Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Starts the Mongoose HTTP server. It initializes the manager, binds a listener, and starts a background task to poll the Mongoose event loop. ```APIDOC ## Mongoose.mg_serve! ### Description Starts the Mongoose HTTP server. It initializes the manager, binds a listener, and starts a background task to poll the Mongoose event loop. The server can run in blocking or non-blocking mode. ### Method N/A (Julia function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia # Start the server on localhost, port 8080, in non-blocking mode # mg_serve!(host="127.0.0.1", port=8080, async=true) # Start the server in blocking mode # mg_serve!(async=false) ``` ### Response #### Success Response (200) N/A (Function starts a server process) #### Response Example N/A ``` -------------------------------- ### Create GET Endpoint with Query Parameters - Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/examples.html Defines a GET endpoint '/greet' that extracts a 'name' from the query parameters. It uses 'mg_query' to get query parameters and 'match' for regex matching. The 'mg_text_reply' function sends a text response. This requires Mongoose.jl. ```julia function greet(conn; kwargs...) query = mg_query(kwargs[:message]) matches = match(r"name=([^&]*)", query) if !isnothing(matches) return mg_text_reply(conn, 200, "Hi $(matches.captures[1])") else return mg_text_reply(conn, 200, "Hi unknown person") end end mg_register!("GET", "/greet", greet) ``` -------------------------------- ### Simple HTTP Server Setup in Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/README.md Demonstrates the core components for setting up a simple HTTP server using Mongoose.jl. This includes loading the library, defining a request handler for JSON responses, registering a route, and starting/shutting down the server. ```julia using Mongoose ``` ```julia function greet(conn; kwargs...) mg_json_reply(conn, 200, "{\"message\":\"Hello World from Julia!\"}") end ``` ```julia mg_register!("get", "/hello", greet) ``` ```julia mg_serve!() ``` ```julia mg_shutdown!() ``` -------------------------------- ### Start Mongoose HTTP Server in Julia Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Starts the Mongoose HTTP server, listening on a specified host and port. It initializes the server and runs an event loop in a background task. ```julia mg_serve!(host::AbstractString="127.0.0.1", port::Integer=8080; async::Bool=true)::Nothing ``` -------------------------------- ### End Mongoose Server - Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/examples.html Shuts down the Mongoose web server. This function gracefully stops the server process. ```julia mg_shutdown!() ``` -------------------------------- ### POST /saygoodbye Endpoint Source: https://github.com/abrja/mongoose.jl/blob/main/docs/src/examples.md Handles POST requests to the /saygoodbye endpoint. It expects a JSON body containing a 'name' field and responds with a JSON object including a goodbye message. ```APIDOC ## POST /saygoodbye ### Description Handles POST requests to the /saygoodbye endpoint. It expects a JSON body containing a 'name' field and responds with a JSON object including a goodbye message. ### Method POST ### Endpoint /saygoodbye ### Parameters #### Query Parameters - **message** (string) - Required - Contains the request details, including the request body. #### Request Body - **name** (string) - Required - The name to include in the goodbye message. ### Request Example ```json { "name": "Alice" } ``` ### Response #### Success Response (200) - **message** (string) - A goodbye message including the provided name. #### Response Example ```json { "message": "Alice" } ``` ``` -------------------------------- ### Create POST Endpoint with JSON Body - Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/examples.html Defines a POST endpoint '/saygoodbye' that processes a JSON request body. It uses 'mg_body' to retrieve the body, 'JSON.parse' to deserialize it, and 'JSON.json' to serialize the response. This snippet requires the JSON package and Mongoose.jl. ```julia using JSON function saygoodbye(conn; kwargs...) body = mg_body(kwargs[:message]) dict = JSON.parse(body) json = Dict("message" => dict["name"]) |> JSON.json return mg_json_reply(conn, 200, json) end mg_register!("POST", "/saygoodbye", saygoodbye) ``` -------------------------------- ### Extract HTTP Method with Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the HTTP method (e.g., GET, POST) from an `MgHttpMessage` object. Returns the method as a Julia String. ```julia mg_method(message::MgHttpMessage) -> String ``` -------------------------------- ### Mongoose.mg_proto Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the protocol string from an `MgHttpMessage` as a Julia `String`. ```APIDOC ## Mongoose.mg_proto ### Description Extracts the protocol string from an `MgHttpMessage` as a Julia `String`. ### Method N/A (Julia function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia # Example usage (assuming 'message' is a valid MgHttpMessage object) # protocol = mg_proto(message) ``` ### Response #### Success Response (200) - **String** - The protocol string (e.g., "HTTP/1.1"). #### Response Example ```json { "example": "HTTP/1.1" } ``` ``` -------------------------------- ### Mongoose Types Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html This section details the core data structures used by Mongoose.jl to represent connections, HTTP messages, and strings. ```APIDOC ## Types ### `Mongoose.MgConnection` **Description**: A type alias for a pointer to a Mongoose connection. This is used to represent a connection to a client in the Mongoose server. **Type**: `Type` ### `Mongoose.MgHttpHeader` **Description**: A Julia representation of Mongoose's `struct mg_http_header`, representing a single HTTP header. **Fields**: * `name::MgStr`: An `MgStr` structure representing the header field name (e.g., "Content-Type"). * `val::MgStr`: An `MgStr` structure representing the header field value (e.g., "application/json"). **Type**: `struct` ### `Mongoose.MgHttpMessage` **Description**: A Julia representation of Mongoose's `struct mg_http_message`, containing parsed information about an HTTP request or response. **Fields**: * `method::MgStr`: The HTTP method (e.g., "GET", "POST"). * `uri::MgStr`: The request URI (e.g., "/api/data"). * `query::MgStr`: The query string part of the URI (e.g., "id=123"). * `proto::MgStr`: The protocol string (e.g., "HTTP/1.1"). * `headers::NTuple{MG_MAX_HTTP_HEADERS, MgHttpHeader}`: A tuple of `MgHttpHeader` structs representing the HTTP headers. * `body::MgStr`: The body of the HTTP message. * `message::MgStr`: The entire raw HTTP message. **Type**: `struct` ### `Mongoose.MgStr` **Description**: A Julia representation of Mongoose's `struct mg_str` which is a view into a string buffer. It's used to represent strings returned by Mongoose. **Fields**: * `ptr::Cstring`: A pointer to the beginning of the string data in memory. * `len::Csize_t`: The length of the string in bytes. **Type**: `struct` ``` -------------------------------- ### Mongoose Utility Methods Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html This section covers utility functions for extracting information from HTTP messages. ```APIDOC ## Utility Methods ### `Mongoose.mg_body` **Description**: Extracts the body of the HTTP message from an `MgHttpMessage` as a Julia `String`. **Method**: `Method` **Signature**: `mg_body(message::MgHttpMessage) -> String` **Arguments**: * `message::MgHttpMessage`: The HTTP message object. **Returns**: * `String`: The body content of the HTTP message. ### `Mongoose.mg_headers` **Description**: Extracts all HTTP headers from an `MgHttpMessage` into a Julia `Named Tuple`. **Method**: `Method` **Signature**: `mg_headers(message::MgHttpMessage) -> NamedTuple` **Arguments**: * `message::MgHttpMessage`: The HTTP message object. **Returns**: * `NamedTuple`: A dictionary where keys are header names and values are header values. ``` -------------------------------- ### Mongoose.mg_register! Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Registers an HTTP request handler for a specific method and URI. ```APIDOC ## Mongoose.mg_register! ### Description Registers an HTTP request handler for a specific method and URI. The handler function should accept a `MgConnection` pointer as its first argument, followed by any additional keyword arguments. ### Method N/A (Julia function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia # Define a handler function function my_handler(conn::MgConnection) mg_reply(conn, 200, "Hello, World!") end # Register the handler for GET requests to /hello mg_register!(:GET, "/hello", my_handler) ``` ### Response #### Success Response (200) N/A (Function modifies server configuration) #### Response Example N/A ``` -------------------------------- ### Mongoose.mg_method Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the HTTP method from an `MgHttpMessage` as a Julia `String`. ```APIDOC ## Mongoose.mg_method ### Description Extracts the HTTP method from an `MgHttpMessage` as a Julia `String`. ### Method N/A (Julia function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia # Example usage (assuming 'message' is a valid MgHttpMessage object) # http_method = mg_method(message) ``` ### Response #### Success Response (200) - **String** - The HTTP method (e.g., "GET", "POST"). #### Response Example ```json { "example": "GET" } ``` ``` -------------------------------- ### Define MgHttpHeader Struct Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Represents a single HTTP header with `name` and `val` fields, both of type `MgStr`. This Julia struct mirrors Mongoose's `struct mg_http_header`. ```julia Mongoose.MgHttpHeader — Type struct MgHttpHeader name::MgStr val::MgStr end A Julia representation of Mongoose's `struct mg_http_header`, representing a single HTTP header. **Fields** * `name::MgStr`: An `MgStr` structure representing the header field name (e.g., "Content-Type"). * `val::MgStr`: An `MgStr` structure representing the header field value (e.g., "application/json"). ``` -------------------------------- ### Mongoose.mg_http_reply Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Sends an HTTP reply to a connected client, including status code, headers, and body. ```APIDOC ## Sending HTTP Replies ### `Mongoose.mg_http_reply` **Description**: Sends an HTTP reply to a connected client. It constructs and sends an HTTP response including the status code, headers, and body. **Method**: `Method` **Signature**: `mg_http_reply(conn::MgConnection, status::Integer, headers::AbstractString, body::AbstractString)::Cvoid` **Arguments**: * `conn::MgConnection`: A pointer to the Mongoose connection to which the reply should be sent. * `status::Integer`: The HTTP status code (e.g., 200 for OK, 404 for Not Found). * `headers::AbstractString`: A string containing HTTP headers, separated by `\r\n`. For example: `"Content-Type: text/plain\r\nCustom-Header: value\r\n"`. * `body::AbstractString`: The body of the HTTP response. ``` -------------------------------- ### Define MgHttpMessage Struct Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Represents a parsed HTTP request or response, mirroring Mongoose's `struct mg_http_message`. It includes fields for method, URI, query, protocol, headers, body, and the raw message. ```julia Mongoose.MgHttpMessage — Type struct MgHttpMessage method::MgStr uri::MgStr query::MgStr proto::MgStr headers::NTuple{MG_MAX_HTTP_HEADERS, MgHttpHeader} body::MgStr message::MgStr end A Julia representation of Mongoose's `struct mg_http_message`, containing parsed information about an HTTP request or response. **Fields** * `method::MgStr`: The HTTP method (e.g., "GET", "POST"). * `uri::MgStr`: The request URI (e.g., "/api/data"). * `query::MgStr`: The query string part of the URI (e.g., "id=123"). * `proto::MgStr`: The protocol string (e.g., "HTTP/1.1"). * `headers::NTuple{MG_MAX_HTTP_HEADERS, MgHttpHeader}`: A tuple of `MgHttpHeader` structs representing the HTTP headers. * `body::MgStr`: The body of the HTTP message. * `message::MgStr`: The entire raw HTTP message. ``` -------------------------------- ### Extract Protocol String with Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the protocol string (e.g., HTTP/1.1) from an `MgHttpMessage` object. Returns the protocol as a Julia String. ```julia mg_proto(message::MgHttpMessage) -> String ``` -------------------------------- ### Send HTTP Reply with Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Sends an HTTP reply to a client connection using the Mongoose server. This function takes the connection, status code, headers, and body as arguments. ```julia Mongoose.mg_http_reply — Method mg_http_reply(conn::MgConnection, status::Integer, headers::AbstractString, body::AbstractString)::Cvoid Sends an HTTP reply to a connected client. It constructs and sends an HTTP response including the status code, headers, and body. **Arguments** * `conn::MgConnection`: A pointer to the Mongoose connection to which the reply should be sent. * `status::Integer`: The HTTP status code (e.g., 200 for OK, 404 for Not Found). * `headers::AbstractString`: A string containing HTTP headers, separated by `\r\n`. For example: `"Content-Type: text/plain\r\nCustom-Header: value\r\n"`. * `body::AbstractString`: The body of the HTTP response. ``` -------------------------------- ### Send JSON Reply using Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Convenience function to send an HTTP reply with Content-Type set to application/json. It utilizes `mg_http_reply` internally. ```julia mg_json_reply(conn::MgConnection, status::Integer, body::AbstractString) ``` -------------------------------- ### Mongoose.mg_query Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the query string from an `MgHttpMessage` as a Julia `String`. ```APIDOC ## Mongoose.mg_query ### Description Extracts the query string from an `MgHttpMessage` as a Julia `String`. ### Method N/A (Julia function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia # Example usage (assuming 'message' is a valid MgHttpMessage object) # query_string = mg_query(message) ``` ### Response #### Success Response (200) - **String** - The query string (e.g., "param=value&id=1"). #### Response Example ```json { "example": "user_id=123&status=active" } ``` ``` -------------------------------- ### Define MgStr Struct Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Represents a string view into a buffer, mirroring Mongoose's `struct mg_str`. It contains a pointer to the string data and its length. ```julia Mongoose.MgStr — Type struct MgStr ptr::Cstring len::Csize_t end A Julia representation of Mongoose's `struct mg_str` which is a view into a string buffer. It's used to represent strings returned by Mongoose. **Fields** * `ptr::Cstring`: A pointer to the beginning of the string data in memory. * `len::Csize_t`: The length of the string in bytes. ``` -------------------------------- ### Send Text Reply using Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Convenience function to send an HTTP reply with Content-Type set to text/plain. It utilizes `mg_http_reply` internally. ```julia mg_text_reply(conn::MgConnection, status::Integer, body::AbstractString) ``` -------------------------------- ### Mongoose.mg_message Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the entire raw HTTP message from an `MgHttpMessage` as a Julia `String`. ```APIDOC ## Mongoose.mg_message ### Description Extracts the entire raw HTTP message from an `MgHttpMessage` as a Julia `String`. ### Method N/A (Julia function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia # Example usage (assuming 'message' is a valid MgHttpMessage object) # raw_http_message = mg_message(message) ``` ### Response #### Success Response (200) - **String** - The complete raw HTTP message string. #### Response Example ```json { "example": "GET / HTTP/1.1\r\nHost: localhost:8080\r\nConnection: keep-alive\r\n...\r\n\r\n" } ``` ``` -------------------------------- ### Mongoose.mg_json_reply Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Sends a JSON response. This is a convenience function that calls `mg_http_reply` with the `Content-Type` header set to `application/json`. ```APIDOC ## Mongoose.mg_json_reply ### Description Sends a JSON response. This is a convenience function that calls `mg_http_reply` with the `Content-Type` header set to `application/json`. ### Method N/A (Julia function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia # Example usage (assuming 'conn' is a valid MgConnection object) # mg_json_reply(conn, 200, "{\"message\": \"Success\"}") ``` ### Response #### Success Response (200) N/A (Function modifies connection) #### Response Example N/A ``` -------------------------------- ### Mongoose.mg_uri Method Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the URI from an `MgHttpMessage` object. ```APIDOC ## Mongoose.mg_uri ### Description Extracts the URI from an `MgHttpMessage` as a Julia `String`. ### Method There is no explicit HTTP method specified, this appears to be an internal Julia method. ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **message** (MgHttpMessage) - Required - The HTTP message object. ### Request Example ```json { "message": "Instance of MgHttpMessage" } ``` ### Response #### Success Response (200) * **return_value** (String) - The request URI (e.g., "/api/users"). #### Response Example ```json { "return_value": "/api/users" } ``` ``` -------------------------------- ### Mongoose.mg_text_reply Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Sends a plain text response. This is a convenience function that calls `mg_http_reply` with the `Content-Type` header set to `text/plain`. ```APIDOC ## Mongoose.mg_text_reply ### Description Sends a plain text response. This is a convenience function that calls `mg_http_reply` with the `Content-Type` header set to `text/plain`. ### Method N/A (Julia function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia # Example usage (assuming 'conn' is a valid MgConnection object) # mg_text_reply(conn, 200, "Hello, Mongoose!") ``` ### Response #### Success Response (200) N/A (Function modifies connection) #### Response Example N/A ``` -------------------------------- ### Extract HTTP Headers from MgHttpMessage Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts all HTTP headers from an `MgHttpMessage` object and organizes them into a Julia `NamedTuple`. This facilitates easy access to header fields. ```julia Mongoose.mg_headers — Method mg_headers(message::MgHttpMessage) -> NamedTuple Extracts all HTTP headers from an `MgHttpMessage` into a Julia `Named Tuple`. **Arguments** * `message::MgHttpMessage`: The HTTP message object. **Returns** `NamedTuple`: A dictionary where keys are header names and values are header values. ``` -------------------------------- ### Mongoose.mg_shutdown! Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Stops the running Mongoose HTTP server. It sets a flag to stop the event loop task and frees associated resources. ```APIDOC ## Mongoose.mg_shutdown! ### Description Stops the running Mongoose HTTP server. It sets a flag to stop the event loop task and frees associated resources. ### Method N/A (Julia function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia # Shut down the Mongoose server # mg_shutdown!() ``` ### Response #### Success Response (200) N/A (Function stops the server process) #### Response Example N/A ``` -------------------------------- ### Define MgConnection Type Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Defines `MgConnection` as a type alias for a pointer to a Mongoose connection, used to represent client connections in the Mongoose server. ```julia Mongoose.MgConnection — Type MgConnection A type alias for a pointer to a Mongoose connection. This is used to represent a connection to a client in the Mongoose server. ``` -------------------------------- ### Extract Query String with Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the query string (e.g., param=value&id=1) from an `MgHttpMessage` object. Returns the query string as a Julia String. ```julia mg_query(message::MgHttpMessage) -> String ``` -------------------------------- ### Register HTTP Request Handler in Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Registers a Julia function to handle HTTP requests for a specific method and URI. The handler function receives the connection object and any parsed arguments. ```julia mg_register!(method::Symbol, uri::AbstractString, handler::Function) ``` -------------------------------- ### Extract Raw HTTP Message with Mongoose.jl Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the complete raw HTTP message from an `MgHttpMessage` object as a Julia String. This is useful for inspecting the full request. ```julia mg_message(message::MgHttpMessage) -> String ``` -------------------------------- ### Stop Mongoose HTTP Server in Julia Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Stops the Mongoose HTTP server gracefully. It signals the background task to exit and releases associated resources. ```julia mg_shutdown!()::Nothing ``` -------------------------------- ### Extract URI from HTTP Message in Julia Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html This method extracts the request URI from an `MgHttpMessage` object. It takes an `MgHttpMessage` as input and returns the URI as a Julia `String`. This is useful for routing and processing incoming HTTP requests. ```julia mg_uri(message::MgHttpMessage) -> String Extracts the URI from an `MgHttpMessage` as a Julia `String`. ``` -------------------------------- ### Extract HTTP Body from MgHttpMessage Source: https://github.com/abrja/mongoose.jl/blob/main/docs/build/api.html Extracts the body content from an `MgHttpMessage` object and returns it as a Julia `String`. This method is useful for processing the payload of an HTTP request or response. ```julia Mongoose.mg_body — Method mg_body(message::MgHttpMessage) -> String Extracts the body of the HTTP message from an `MgHttpMessage` as a Julia `String`. **Arguments** * `message::MgHttpMessage`: The HTTP message object. **Returns** `String`: The body content of the HTTP message. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.