master
Chunting Gu 7 years ago
commit 74172b5b0c

@ -2,6 +2,8 @@
A lightweight C++ REST and SOAP client and server library based on *Boost.Asio*. A lightweight C++ REST and SOAP client and server library based on *Boost.Asio*.
*Web* represents *Web Service*, and *cc* represents *C++* since it's a commonly used C++ source file extension name (especially in Google's source code).
Please turn to our [Wiki](https://github.com/sprinfall/webcc/wiki) for more tutorials and guides. Please turn to our [Wiki](https://github.com/sprinfall/webcc/wiki) for more tutorials and guides.
## Quick Start ## Quick Start
@ -62,10 +64,11 @@ As you can see, all you have to do is to override the proper virtual functions w
The detailed implementation is out of the scope of this document, but here is an example: The detailed implementation is out of the scope of this document, but here is an example:
```cpp ```cpp
bool BookDetailService::Get(const std::vector<std::string>& url_sub_matches, void BookDetailService::Get(const std::vector<std::string>& url_sub_matches,
const webcc::UrlQuery& query, const webcc::UrlQuery& query,
webcc::RestResponse* response) { webcc::RestResponse* response) {
if (url_sub_matches.size() != 1) { if (url_sub_matches.size() != 1) {
// Invalid URL.
response->status = webcc::HttpStatus::kBadRequest; response->status = webcc::HttpStatus::kBadRequest;
return; return;
} }
@ -95,7 +98,7 @@ server.Bind(std::make_shared<BookDetailService>(), "/books/(\\d+)", true);
server.Run(); server.Run();
``` ```
**Please see `example/rest_book_server` for the complete example.** Please see `example/rest_book_server` for the complete example.
## Build Instructions ## Build Instructions

Loading…
Cancel
Save