diff --git a/README.md b/README.md index 8dfdde1..8cd08d9 100644 --- a/README.md +++ b/README.md @@ -21,16 +21,14 @@ The first two operations can be implemented by deriving from `webcc::RestListSer ```cpp class BookListService : public webcc::RestListService { protected: - // Query books based on some criterias. - // GET /books? + // Get a list of books based on query parameters. void Get(const webcc::UrlQuery& query, - webcc::RestResponse* response) override; + webcc::RestResponse* response) final; - // Add a new book. - // POST /books + // Create a new book. // The new book's data is attached as request content in JSON format. void Post(const std::string& request_content, - webcc::RestResponse* response) override; + webcc::RestResponse* response) final; }; ``` @@ -42,18 +40,18 @@ The others, derive from `webcc::RestDetailService`: class BookDetailService : public webcc::RestDetailService { protected: // Get the detailed information of a book. - void Get(const std::vector& url_sub_matches, + void Get(const webcc::UrlSubMatches& url_sub_matches, const webcc::UrlQuery& query, - webcc::RestResponse* response) override; + webcc::RestResponse* response) final; - // Update the information of a book. - void Put(const std::vector& url_sub_matches, + // Update a book. + void Put(const webcc::UrlSubMatches& url_sub_matches, const std::string& request_content, - webcc::RestResponse* response) override; + webcc::RestResponse* response) final; // Delete a book. - void Delete(const std::vector& url_sub_matches, - webcc::RestResponse* response) override; + void Delete(const webcc::UrlSubMatches& url_sub_matches, + webcc::RestResponse* response) final; }; ``` @@ -62,7 +60,7 @@ 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: ```cpp -void BookDetailService::Get(const std::vector& url_sub_matches, +void BookDetailService::Get(const webcc::UrlSubMatches& url_sub_matches, const webcc::UrlQuery& query, webcc::RestResponse* response) { if (url_sub_matches.size() != 1) { diff --git a/example/rest_book_server/services.h b/example/rest_book_server/services.h index ef48be0..026e254 100644 --- a/example/rest_book_server/services.h +++ b/example/rest_book_server/services.h @@ -16,7 +16,6 @@ class BookListService : public webcc::RestListService { protected: // Get a list of books based on query parameters. - // Support query parameters. void Get(const webcc::UrlQuery& query, webcc::RestResponse* response) final; // Create a new book.