main.cpp 448 B

123456789101112131415
  1. #include <include/cinatra.hpp>
  2. #include <iostream>
  3. using namespace cinatra;
  4. using namespace std::chrono_literals;
  5. int main() {
  6. coro_http_server server(std::thread::hardware_concurrency(), 8090);
  7. server.set_http_handler<GET>(
  8. "/plaintext", [](coro_http_request &req, coro_http_response &resp) {
  9. resp.need_date_head(false);
  10. resp.set_status_and_content(status_type::ok, "Hello, world!");
  11. });
  12. server.sync_start();
  13. }