Routers
Creating the First Pages
Server Context
In Manapi Http, you can use HTTP with multithreading.
Because of this, you need to use manapi::net::http::server_ctx.
To create it, use manapi::net::http::server_ctx::create before starting the context.
You can then use the context in HTTP routers with manapi::net::http::server::create.
manapi::net::http::server supports many methods:
Note
You can also use custom methods with
manapi::net::http::server::handler.Sharing Pages
You can share files using the manapi::net::http::server::GET method.
Layer Pages
You can create layers using the +layer keyword in the URL.
Note
Use
req.stop_propagation() to prevent further execution of subsequent layers.Error Pages
Display error pages for server errors or when a page does not exist.
Custom Page
Show a page for URLs that start with a specified string.
URL Parameters
Use req.param() to retrieve data from the URL.