Skip to content

emwanwei163/asio_http

 
 

Repository files navigation

asio_http

A simple multithread async http server based on asio

Build Status Coverage Status

Usage

using namespace http::server;
server s("127.0.0.1", "8080", 1);

s.add_handler("/hello", [](const request &req) {
  reply rep;
  rep.content = "hello world!";
  rep.status = reply::ok;
  rep.headers["Content-Length"] = std::to_string(rep.content.size());
  rep.headers["Content-Type"] = "text/plain";
  return rep;
});

// Run the server until stopped.
s.run();

See example/main.cpp for a complete example

Build

mkdir build && cd build
cmake .. -DBUILD_EXAMPLE -DCMAKE_BUILD_TYPE=Release

License

MIT License

Based on the examples from asio licensed by Boost License.

About

A simple http server based on asio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 95.8%
  • CMake 4.2%