Awesome Open Source
Awesome Open Source


C/C++ CI Build Status

This library make http (with json) microservice easy!


  • Base on linux epoll
  • Multi-thread model

Performance (without log print)

  • Connect per request: qps 12000+ (ab -c 10 -n 10000 localhost:3456/hello)
  • Connection keep alive: qps 18000+ (ab -c 10 -n 10000 -k localhost:3456/hello)

Build && Test

 make && make test && ./output/test/hello_server 3456
 curl "localhost:3456/hello"

Function List

  • http 1.0/1.1(keep-alive support) GET/POST request
  • response as json format


#include <sstream>
#include <cstdlib>
#include "simple_log.h"
#include "http_server.h"

// Make sure the callback method is threadsafe
void login(Request &request, Json::Value &root) {
    std::string name = request.get_param("name");
    std::string pwd = request.get_param("pwd");

    LOG_DEBUG("login user which name:%s, pwd:%s", name.c_str(), pwd.c_str());
    root["code"] = 0;
    root["msg"] = "login success!";

int main() {
    HttpServer http_server;
    http_server.add_mapping("/login", login, POST_METHOD);

    return 0;


[email protected]:~/workspace/ehttp$ curl -d "name=tom&pwd=3" "localhost:3456/login"
{"code":0,"msg":"login success!"}
Alternatives To Ehttp
Select To Compare

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
C Plus Plus (258,303
Server (65,687
Json (40,085
Http (30,287
Microservice (12,346
Epoll (675