Using Boost and Served Libraries to Build a C++ REST API Service

Petr Plavjaník
5 min readAug 19, 2019

We will build a simple REST API service in C++ using Served library from scratch.

I have been developing REST APIs on different platforms and programming languages. The benefit of using C++ is high-performance, minimum dependencies, and smaller footprint. Today, we will be running the service on our computer. Later, we will see how to run it in a Docker container and deploy it to other platforms.

Served is a C++ library for building high-performance RESTful web servers. Served builds upon Boost.ASIO to provide a simple API for developers to create HTTP services in C++.

Boost is a set of libraries for the C++ programming language which provides support for tasks and structures such as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions, and unit testing. It contains over eighty individual libraries.

This tutorial provides a step by step instructions on how to build and debug such C++ program on Mac.

Photo by Max Nelson on Unsplash

1. Install Homebrew and CMake

Homebrew is a package for macOS.

Install it using the following command:

/usr/bin/ruby -e "$(curl -fsSL…

--

--

Petr Plavjaník
Petr Plavjaník

Written by Petr Plavjaník

Petr’s main areas of expertise are mainframes and automation, and using modern development tools and languages such as Java, Python, and Node.js on z/OS.