Create request handler.
| 4 | |
| 5 | // Create request handler. |
| 6 | restinio::request_handling_status_t handler( const restinio::request_handle_t& req ) |
| 7 | { |
| 8 | if( restinio::http_method_get() == req->header().method() && |
| 9 | req->header().request_target() == "/" ) |
| 10 | { |
| 11 | req->create_response() |
| 12 | .append_header( restinio::http_field::server, "RESTinio hello world server" ) |
| 13 | .append_header_date_field() |
| 14 | .append_header( restinio::http_field::content_type, "text/plain; charset=utf-8" ) |
| 15 | .set_body( fmt::format( |
| 16 | RESTINIO_FMT_FORMAT_STRING( "{}: Hello world!" ), |
| 17 | restinio::fmtlib_tools::streamed( req->remote_endpoint() ) ) ) |
| 18 | .done(); |
| 19 | |
| 20 | return restinio::request_accepted(); |
| 21 | } |
| 22 | |
| 23 | return restinio::request_rejected(); |
| 24 | } |
| 25 | |
| 26 | int main() |
| 27 | { |
nothing calls this directly
no test coverage detected