Skip to content
A high-performance REST Toolkit written in C++
Branch: master
Clone or download
dennisjenkins75 Merge pull request #560 from sourcedelica/version-install-source
Change version.h and libpistache.pc install source location to use CMAKE_CURRENT_BINARY_DIR
Latest commit 2f039d4 Jun 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CMakeModules Added RapidJSON as third-party dependency to build rest_description e… Feb 19, 2019
assets Added github stuff Mar 28, 2016
debian All client request headers are now preserved in rawList(), regardless… Jun 12, 2019
docs Adding docs target built with doxygen Feb 26, 2019
examples add SIGHUP handling to http_server_shutdown example Jun 8, 2019
guide Guide: fixed typo in response streaming part. end -> ends Jun 18, 2017
include/pistache passing const reference instead of a var for the functions time_of_da… Jun 14, 2019
src Merge pull request #558 from bdvd/bugfix/minor_imrovements Jun 14, 2019
tests Merge pull request #550 from iroddis/response_limit Jun 12, 2019
third-party Merge branch 'master' into arthurafarias-fix-missing-example-hello-se… Feb 20, 2019
.gitignore Update .gitignore Mar 11, 2019
.gitmodules Merge branch 'master' into arthurafarias-fix-missing-example-hello-se… Feb 20, 2019
.travis.yml include/pistache/mime.h: Fixed rounding error which made mime_test an… Apr 7, 2019
404.html Removed Fork me ribbon and centered github buttons Mar 28, 2016
CMakeLists.txt Change version.h and libpistache.pc install source location to use CM… Jun 15, 2019
CNAME Added CNAME file Feb 13, 2016
LICENSE Initial commit Aug 12, 2015
README.md README.md: Added notes for new supported architectures... May 27, 2019
index.html Removed Fork me ribbon and centered github buttons Mar 28, 2016
libpistache.pc.in Added OpenSSL support to pkg-config manifest... Nov 15, 2018
quickstart.html Fixed wrong stable PPA name in the website. Apr 28, 2019
version.txt All client request headers are now preserved in rawList(), regardless… Jun 12, 2019

README.md

Pistache

N|Solid Travis Build Status

Pistache is a modern and elegant HTTP and REST framework for C++. It is entirely written in pure-C++11 and provides a clear and pleasant API.

Documentation

We are still looking for a volunteer to document fully the API. In the mean time, partial documentation is available at http://pistache.io. If you are interested in helping with this, please open an issue ticket.

Contributing

Pistache is released under the Apache License 2.0. Contributors are welcome!

Pistache was originally created by Mathieu Stefani, but he is no longer actively maintaining Pistache. A team of volunteers has taken over. To reach the original maintainer, drop a private message to @octal in cpplang Slack channel.

For those that prefer IRC over Slack, the rag-tag crew of maintainers idle in #pistache on Freenode. Please come and join us!

Precompiled Packages

Debian and Ubuntu

We have submitted both a Request for Packaging and a Request for Sponsorship downstream to Debian. Once Pistache has an official Debian package maintainer intimately familiar with the Debian Policy Manual, we can expect to eventually see Pistache available in Debian and all Debian based distributions (e.g. Ubuntu and many others).

But until then currently Pistache has partially compliant upstream Debianization. Our long term goal is to have our source package properly Debianized downstream by a Debian Policy Manual SME. In the mean time consider using our PPAs to avoid having to build from source.

Supported Architectures

Currently Pistache is built and tested on a number of architectures. Some of these are suitable for desktop or server use and others for embedded environments. As of this writing we do not currently have any MIPS related packages that have been either built or tested.

  • amd64
  • arm64
  • armhf (build fails at this moment)
  • i386
  • ppc64el
  • s390x

Ubuntu PPA (Stable)

If you would like to use stable packages, run the following:

$ sudo add-apt-repository ppa:kip/pistache
$ sudo apt update
$ sudo apt install libpistache-dev

Ubuntu PPA (Unstable)

To use unstable packages, run the following:

$ sudo add-apt-repository ppa:kip/pistache-unstable
$ sudo apt update
$ sudo apt install libpistache-dev

Use via pkg-config

If you would like to automatically have your project's build environment use the appropriate compiler and linker build flags necessary to use Pistache, pkg-config can greatly simplify things. The libpistache-dev package includes a pkg-config manifest.

To use with the GNU Autotools, as an example, include the following snippet in your project's configure.ac:


    # Pistache...
    PKG_CHECK_MODULES(
        [libpistache], [libpistache >= 0.0], [],
        [AC_MSG_ERROR([libpistache >= 0.0 missing...])])
    YOURPROJECT_CXXFLAGS="$YOURPROJECT_CXXFLAGS $libpistache_CFLAGS"
    YOURPROJECT_LIBS="$YOURPROJECT_LIBS $libpistache_LIBS"
    

Building from source

To download the latest available release, clone the repository over github.

    git clone https://github.com/oktal/pistache.git

Then, init the submodules:

    git submodule update --init

Now, compile the sources:

    cd pistache
    mkdir -p {build,prefix}
    cd build
    cmake -G "Unix Makefiles" \
        -DCMAKE_BUILD_TYPE=Release \
        -DPISTACHE_BUILD_EXAMPLES=true \
        -DPISTACHE_BUILD_TESTS=true \
        -DPISTACHE_BUILD_DOCS=false \
        -DPISTACHE_USE_SSL=true \
        -DCMAKE_INSTALL_PREFIX=$PWD/../prefix \
        ../
    make -j
    make install

If you chose to build the examples, then perform the following to build the examples.

    cd examples
    make -j

Optionally, you can also build and run the tests (tests require the examples):

    cmake -G "Unix Makefiles" -DPISTACHE_BUILD_EXAMPLES=true -DPISTACHE_BUILD_TESTS=true ..
    make test test_memcheck

Be patient, async_test can take some time before completing. And that's it, now you can start playing with your newly installed Pistache framework.

Some other CMAKE defines:

Option Default Description
PISTACHE_BUILD_EXAMPLES False Build all of the example apps
PISTACHE_BUILD_TESTS False Build all of the unit tests
PISTACHE_ENABLE_NETWORK_TESTS True Run unit tests requiring remote network access
PISTACHE_USE_SSL False Build server with SSL support

Example

Hello World (server)

#include <pistache/endpoint.h>

using namespace Pistache;

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

int main() {
  Http::listenAndServe<HelloHandler>("*:9080");
}
You can’t perform that action at this time.