|
@@ -32,7 +32,7 @@ but simpler apis and richer protocols.
|
|
|
### http
|
|
### http
|
|
|
see examples/httpd.cpp
|
|
see examples/httpd.cpp
|
|
|
```
|
|
```
|
|
|
-#include "http_server.h"
|
|
|
|
|
|
|
+#include "HttpServer.h"
|
|
|
|
|
|
|
|
int http_api_hello(HttpRequest* req, HttpResponse* res) {
|
|
int http_api_hello(HttpRequest* req, HttpResponse* res) {
|
|
|
res->body = "hello";
|
|
res->body = "hello";
|
|
@@ -42,7 +42,7 @@ int http_api_hello(HttpRequest* req, HttpResponse* res) {
|
|
|
int main() {
|
|
int main() {
|
|
|
HttpService service;
|
|
HttpService service;
|
|
|
service.base_url = "/v1/api";
|
|
service.base_url = "/v1/api";
|
|
|
- service.AddApi("/hello", http_api_hello);
|
|
|
|
|
|
|
+ service.AddApi("/hello", HTTP_GET, http_api_hello);
|
|
|
|
|
|
|
|
http_server_t server;
|
|
http_server_t server;
|
|
|
server.port = 8080;
|
|
server.port = 8080;
|