Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

served

> 数据库
Open source

A C++11 RESTful web server library

703 stars0 likes3 views
WebsiteGitHub

About

A C++11 RESTful web server library

Served

Overview

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++.

Features:

  • HTTP 1.1 compatible request parser
  • Middleware / plug-ins
  • Flexible handler API
  • Cross-platform compatible

Installation

Requirements

  • [Required] - Boost (1.53 or newer)
  • [Optional] - Ragel

Building

bash
$ git clone [email protected]:meltwater/served.git
$ mkdir served.build && cd served.build
$ cmake ../served && make

Or, using bazel:

bash
$ git clone [email protected]:meltwater/served.git
$ cd served
$ bazel build :served
$ bazel test :served-test

Getting Started

The most basic example of creating a server and handling a HTTP GET for the path /hello:

cpp
#include 

int main(int argc, char const* argv[]) {
	// Create a multiplexer for handling requests
	served::multiplexer mux;

	// GET /hello
	mux.handle("/hello")
		.get([](served::response & res, const served::request & req) {
			res 
// ...
mux.use_after(served::plugin::access_log);

You can also access the other elements of the request, including headers and components of the URI:

cpp
mux.handle("/posts/{id:\\d+}")
	.post([](served::response & res, const served::request & req) {
		if (req.header("Content-Type") != "application/json") {
			served::response::stock_reply(400, res);
			return;
		}
		res << req.url().fragment();
	});

Compile Options

Option Purpose
SERVED_BUILD_SHARED Build shared library
SERVED_BUILD_STATIC Build static library
SERVED_BUILD_TESTS Build unit test suite
SERVED_BUILD_EXAMPLES Build bundled examples
SERVED_BUILD_DEB Build DEB package (note: you must also have dpkg installed)
SERVED_BUILD_RPM Build RPM package (note: you must also have rpmbuild installed)

System Compatibility

OS Compiler Status
Linux GCC 4.8 Working
OSX Clang 3.5 Working

TODO

  • Chunked encoding support

Contributing

Pull requests are welcome.

Authors

  • @cjgdev
  • @Jeffail

Copyright

See LICENSE.md document

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++data-platformdatasift

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库