Pistache

An elegant C++ REST framework.

Pistache

Pistache is a C++ REST framework written by Mathieu Stefani at Datacratic. It is written in pure C++11 with no external dependency and provides a low-level HTTP abstraction.

Pistache provides both an HTTP client and server that can be used to create and query complex web and REST APIs.

It’s completly free and Apache-licensed.

Modern API

Playing with Pistache and its modern API is fun and easy

struct HelloHandler : public Http::Handler {
    void onRequest(const Http::Request& req, Http::ResponseWriter response) {
        response.send(Http::Code::Ok, "Hello, World");
    }
};

int main() {
    Http::listenAndServe<HelloHandler>("*:9080");
}
curl http://127.0.0.1:9080
Hello, World

What’s in the box

  • A multi-threaded http server to build your APIs
  • An asynchronous http client to request APIS
  • An HTTP router to dispatch requests to C++ functions
  • A REST description DSL to easily define your APIs
  • Type-safe headers and MIME types implementation

Use it