From 0d7d2ac8ec3b29ae711089c33670893a34acf4ab Mon Sep 17 00:00:00 2001 From: Adam Gu Date: Tue, 22 May 2018 15:48:53 +0800 Subject: [PATCH] Update quick example in README. --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3b74cb7..9944804 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,13 @@ class BookDetailService : public webcc::RestDetailService { protected: // Get the detailed information of a book. bool Get(const std::vector& url_sub_matches, + const webcc::UrlQuery& query, std::string* response_content) final; // Update the information of a book. - bool Patch(const std::vector& url_sub_matches, - const std::string& request_content, - std::string* response_content) final; + bool Put(const std::vector& url_sub_matches, + const std::string& request_content, + std::string* response_content) final; // Delete a book. bool Delete(const std::vector& url_sub_matches) final; @@ -59,6 +60,7 @@ The detailed implementation is out of the scope of this document, but here is an ```cpp bool BookDetailService::Get(const std::vector& url_sub_matches, + const webcc::UrlQuery& query, std::string* response_content) { if (url_sub_matches.size() != 1) { return false; @@ -76,11 +78,8 @@ Last step, register the services and run the server: ```cpp webcc::RestServer server(8080, 2); -server.RegisterService(std::make_shared(), - "/books"); - -server.RegisterService(std::make_shared(), - "/book/(\\d+)"); +server.Bind(std::make_shared(), "/books", false); +server.Bind(std::make_shared(), "/book/(\\d+)", true); server.Run(); ```