mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-11-29 18:27:43 +08:00
Update README.md and the banner image
This commit is contained in:
parent
40464da6b2
commit
56eaca1998
@ -111,7 +111,7 @@ void TestCtrl::asyncHandleHttpRequest(const HttpRequestPtr& req,
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Don't be scared by the code, most of the above programs can be automatically generated by the command line tool `drogon_ctl` provided by drogon**. All the user needs to do is add their own business logic. In the example, the controller returns a `Hello, world!` string when the client accesses the `http://ip/test` URL.
|
**Most of the above programs can be automatically generated by the command line tool `drogon_ctl` provided by drogon** (The cammand is `drogon_ctl create controller TestCtrl`). All the user needs to do is add their own business logic. In the example, the controller returns a `Hello, world!` string when the client accesses the `http://ip/test` URL.
|
||||||
|
|
||||||
For JSON format response, we create the controller as follows:
|
For JSON format response, we create the controller as follows:
|
||||||
|
|
||||||
|
BIN
drogon.jpg
BIN
drogon.jpg
Binary file not shown.
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 44 KiB |
@ -26,6 +26,7 @@
|
|||||||
#define RED "\033[31m" /* Red */
|
#define RED "\033[31m" /* Red */
|
||||||
#define GREEN "\033[32m" /* Green */
|
#define GREEN "\033[32m" /* Green */
|
||||||
|
|
||||||
|
#define JPG_LEN 44618
|
||||||
using namespace drogon;
|
using namespace drogon;
|
||||||
|
|
||||||
void outputGood(const HttpRequestPtr &req, bool isHttps)
|
void outputGood(const HttpRequestPtr &req, bool isHttps)
|
||||||
@ -460,7 +461,7 @@ void doTest(const HttpClientPtr &client, std::promise<int> &pro, bool isHttps =
|
|||||||
client->sendRequest(req, [=, &pro](ReqResult result, const HttpResponsePtr &resp) {
|
client->sendRequest(req, [=, &pro](ReqResult result, const HttpResponsePtr &resp) {
|
||||||
if (result == ReqResult::Ok)
|
if (result == ReqResult::Ok)
|
||||||
{
|
{
|
||||||
if (resp->getBody().length() == 52594)
|
if (resp->getBody().length() == JPG_LEN)
|
||||||
{
|
{
|
||||||
outputGood(req, isHttps);
|
outputGood(req, isHttps);
|
||||||
auto lastModified = resp->getHeader("last-modified");
|
auto lastModified = resp->getHeader("last-modified");
|
||||||
@ -566,7 +567,7 @@ void doTest(const HttpClientPtr &client, std::promise<int> &pro, bool isHttps =
|
|||||||
client->sendRequest(req, [=](ReqResult result, const HttpResponsePtr &resp) {
|
client->sendRequest(req, [=](ReqResult result, const HttpResponsePtr &resp) {
|
||||||
if (result == ReqResult::Ok)
|
if (result == ReqResult::Ok)
|
||||||
{
|
{
|
||||||
if (resp->getBody().length() == 52594)
|
if (resp->getBody().length() == JPG_LEN)
|
||||||
{
|
{
|
||||||
outputGood(req, isHttps);
|
outputGood(req, isHttps);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user