RESTFUL API Server in C++
来源:互联网 发布:热血封神翅膀进阶数据 编辑:程序博客网 时间:2024/05/28 23:10
https://github.com/eidheim/Simple-Web-Server
Simple-Web-Server
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
See https://github.com/eidheim/Simple-WebSocket-Server for an easy way to make WebSocket/WebSocket Secure endpoints in C++. Also, feel free to check out the new C++ IDE supporting C++11/14/17:https://github.com/cppit/jucipp.
Features
- Thread pool
- Platform independent
- HTTPS support
- HTTP persistent connection (for HTTP/1.1)
- Client supports chunked transfer encoding
- Timeouts, if any of Server::timeout_request and Server::timeout_content are >0 (default: Server::timeout_request=5 seconds, and Server::timeout_content=300 seconds)
- Simple way to add REST resources using regex for path, and anonymous functions
- Possibility to flush response to clients synchronously (Server::Response::flush).
Usage
See http_examples.cpp or https_examples.cpp for example usage.
See particularly the JSON-POST (using Boost.PropertyTree) and the GET /match/[number] examples, which are most relevant.
The default_resource includes example use of Server::Response::flush.
Dependencies
- Boost C++ libraries
- For HTTPS: OpenSSL libraries
Compile and run
Compile with a C++11 compliant compiler:
cmake .make
HTTP
Run the server and client examples: ./http_examples
Direct your favorite browser to for instance http://localhost:8080/
HTTPS
Before running the server, an RSA private key (server.key) and an SSL certificate (server.crt) must be created. Follow, for instance, the instructions given here (for a self-signed certificate):http://www.akadia.com/services/ssh_test_certificate.html
Run the server and client examples: ./https_examples
Direct your favorite browser to for instance https://localhost:8080/
- RESTFUL API Server in C++
- PUT or POST in RESTful API design
- RestFul API
- RESTful API
- RESTful API
- Restful API
- RESTful API
- RESTful API
- RESTful API
- RESTful API
- restful api
- RESTful API
- Restful API
- Restful API
- RESTful API
- RESTful API
- RESTful API
- RESTful API
- 实验报告
- Linux进程学习---fork()和vfork()
- JAVA版微信支付V3-完全版
- web前端开发常用的几个js效果
- 2016SDAU课程练习三1014 Problem N
- RESTFUL API Server in C++
- 报数
- Java编写计算器
- 123
- Android 帧动画 FrameAnimation 简单DEMO
- socket.io框架学习
- Unity3d碰撞ios的坑
- Light oj 1002 - Country Roads 迪杰斯特拉变形
- CodeIgniter框架下实现表单传值