Update book server example

master
Chunting Gu 6 years ago committed by GitHub
parent abbc4423cf
commit a5358952ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -204,7 +204,7 @@ int main() {
下面看一个更复杂的例子。 下面看一个更复杂的例子。
### 在线书店 ### Book Server
假定你想创建一个关于书的服务,提供下面这些 REST API 假定你想创建一个关于书的服务,提供下面这些 REST API
@ -227,11 +227,9 @@ public:
if (request->method() == "GET") { if (request->method() == "GET") {
return Get(request); return Get(request);
} }
if (request->method() == "POST") { if (request->method() == "POST") {
return Post(request); return Post(request);
} }
return {}; return {};
} }
@ -253,15 +251,12 @@ public:
if (request->method() == "GET") { if (request->method() == "GET") {
return Get(request); return Get(request);
} }
if (request->method() == "PUT") { if (request->method() == "PUT") {
return Put(request); return Put(request);
} }
if (request->method() == "DELETE") { if (request->method() == "DELETE") {
return Delete(request); return Delete(request);
} }
return {}; return {};
} }
@ -335,4 +330,4 @@ int main(int argc, char* argv[]) {
} }
``` ```
完整实现请见 [examples/rest_book_server.cc](https://github.com/sprinfall/webcc/tree/master/examples/rest_book_server.cc)。 完整实现请见 [examples/book_server](https://github.com/sprinfall/webcc/tree/master/examples/book_server)。

Loading…
Cancel
Save