From 2dd0cd8ee5c62e85587177af72824235c14b3c70 Mon Sep 17 00:00:00 2001 From: Chuck <32836622+chuckn408@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:23:42 -0700 Subject: [PATCH 1/7] Organize Localization files to individual folders. Organize Localization files to individual folders. --- .../CHN-01-\346\246\202\350\277\260.md" | 0 .../CHN-02-\345\256\211\350\243\205.md" | 0 .../CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" | 0 ...6\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" | 0 ...-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" | 0 ...N-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" | 0 ...3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" | 0 ...44\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" | 0 .../CHN-06-\350\247\206\345\233\276.md" | 0 .../CHN-07-\344\274\232\350\257\235.md" | 0 ...6\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" | 0 .../CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" | 0 ...6\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" | 0 .../CHN-08-3-\346\225\260\346\215\256\345\272\223-ORM.md" | 0 ...CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" | 0 ...50\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" | 0 .../CHN-09-\346\217\222\344\273\266.md" | 0 .../CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" | 0 .../CHN-11-drogon_ctl\345\221\275\344\273\244.md" | 0 ...45\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" | 0 .../CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" | 0 .../CHN-14-Coz\345\210\206\346\236\220.md" | 0 .../CHN-15-Brotli\345\216\213\347\274\251.md" | 0 .../CHN-16-\345\215\217\347\250\213.md" | 0 CHN-17-Redis.md => CHN/CHN-17-Redis.md | 0 .../CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" | 0 ...CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" | 0 CHN-FAQ.md => CHN/CHN-FAQ.md | 0 Home.zh-CN.md => CHN/Home.zh-CN.md | 0 ENG-01-Overview.md => ENG/ENG-01-Overview.md | 0 ENG-02-Installation.md => ENG/ENG-02-Installation.md | 0 ENG-03-Quick-Start.md => ENG/ENG-03-Quick-Start.md | 0 .../ENG-04-0-Controller-Introduction.md | 0 .../ENG-04-1-Controller-HttpSimpleController.md | 0 .../ENG-04-2-Controller-HttpController.md | 0 .../ENG-04-3-Controller-WebSocketController.md | 0 .../ENG-05-Middleware-and-Filter.md | 0 ENG-06-View.md => ENG/ENG-06-View.md | 0 ENG-07-Session.md => ENG/ENG-07-Session.md | 0 ENG-08-0-Database-General.md => ENG/ENG-08-0-Database-General.md | 0 .../ENG-08-1-Database-DbClient.md | 0 .../ENG-08-2-Database-Transaction.md | 0 ENG-08-3-Database-ORM.md => ENG/ENG-08-3-Database-ORM.md | 0 .../ENG-08-4-Database-FastDbClient.md | 0 .../ENG-08-5-Database-auto_batch.md | 0 .../ENG-09-0-References-request.md | 0 ENG-09-1-File-Handler.md => ENG/ENG-09-1-File-Handler.md | 0 ENG-10-Plugins.md => ENG/ENG-10-Plugins.md | 0 ENG-11-Configuration-File.md => ENG/ENG-11-Configuration-File.md | 0 ENG-12-drogon_ctl-Command.md => ENG/ENG-12-drogon_ctl-Command.md | 0 .../ENG-13-AOP-Aspect-Oriented-Programming.md | 0 ENG-14-Benchmarks.md => ENG/ENG-14-Benchmarks.md | 0 ENG-15-Coz.md => ENG/ENG-15-Coz.md | 0 ENG-16-Brotli.md => ENG/ENG-16-Brotli.md | 0 ENG-17-Coroutines.md => ENG/ENG-17-Coroutines.md | 0 ENG-18-Redis.md => ENG/ENG-18-Redis.md | 0 ENG-19-Testing-Framework.md => ENG/ENG-19-Testing-Framework.md | 0 .../ENG-FAQ-1-Understanding-drogon-threading-model.md | 0 ENG-FAQ.md => ENG/ENG-FAQ.md | 0 Home.md => ENG/Home.md | 0 60 files changed, 0 insertions(+), 0 deletions(-) rename "CHN-01-\346\246\202\350\277\260.md" => "CHN/CHN-01-\346\246\202\350\277\260.md" (100%) rename "CHN-02-\345\256\211\350\243\205.md" => "CHN/CHN-02-\345\256\211\350\243\205.md" (100%) rename "CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" => "CHN/CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" (100%) rename "CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" => "CHN/CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" (100%) rename "CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" => "CHN/CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" (100%) rename "CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" => "CHN/CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" (100%) rename "CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" => "CHN/CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" (100%) rename "CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" => "CHN/CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" (100%) rename "CHN-06-\350\247\206\345\233\276.md" => "CHN/CHN-06-\350\247\206\345\233\276.md" (100%) rename "CHN-07-\344\274\232\350\257\235.md" => "CHN/CHN-07-\344\274\232\350\257\235.md" (100%) rename "CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" => "CHN/CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" (100%) rename "CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" => "CHN/CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" (100%) rename "CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" => "CHN/CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" (100%) rename "CHN-08-3-\346\225\260\346\215\256\345\272\223-ORM.md" => "CHN/CHN-08-3-\346\225\260\346\215\256\345\272\223-ORM.md" (100%) rename "CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" => "CHN/CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" (100%) rename "CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" => "CHN/CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" (100%) rename "CHN-09-\346\217\222\344\273\266.md" => "CHN/CHN-09-\346\217\222\344\273\266.md" (100%) rename "CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" => "CHN/CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" (100%) rename "CHN-11-drogon_ctl\345\221\275\344\273\244.md" => "CHN/CHN-11-drogon_ctl\345\221\275\344\273\244.md" (100%) rename "CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" => "CHN/CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" (100%) rename "CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" => "CHN/CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" (100%) rename "CHN-14-Coz\345\210\206\346\236\220.md" => "CHN/CHN-14-Coz\345\210\206\346\236\220.md" (100%) rename "CHN-15-Brotli\345\216\213\347\274\251.md" => "CHN/CHN-15-Brotli\345\216\213\347\274\251.md" (100%) rename "CHN-16-\345\215\217\347\250\213.md" => "CHN/CHN-16-\345\215\217\347\250\213.md" (100%) rename CHN-17-Redis.md => CHN/CHN-17-Redis.md (100%) rename "CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" => "CHN/CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" (100%) rename "CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" => "CHN/CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" (100%) rename CHN-FAQ.md => CHN/CHN-FAQ.md (100%) rename Home.zh-CN.md => CHN/Home.zh-CN.md (100%) rename ENG-01-Overview.md => ENG/ENG-01-Overview.md (100%) rename ENG-02-Installation.md => ENG/ENG-02-Installation.md (100%) rename ENG-03-Quick-Start.md => ENG/ENG-03-Quick-Start.md (100%) rename ENG-04-0-Controller-Introduction.md => ENG/ENG-04-0-Controller-Introduction.md (100%) rename ENG-04-1-Controller-HttpSimpleController.md => ENG/ENG-04-1-Controller-HttpSimpleController.md (100%) rename ENG-04-2-Controller-HttpController.md => ENG/ENG-04-2-Controller-HttpController.md (100%) rename ENG-04-3-Controller-WebSocketController.md => ENG/ENG-04-3-Controller-WebSocketController.md (100%) rename ENG-05-Middleware-and-Filter.md => ENG/ENG-05-Middleware-and-Filter.md (100%) rename ENG-06-View.md => ENG/ENG-06-View.md (100%) rename ENG-07-Session.md => ENG/ENG-07-Session.md (100%) rename ENG-08-0-Database-General.md => ENG/ENG-08-0-Database-General.md (100%) rename ENG-08-1-Database-DbClient.md => ENG/ENG-08-1-Database-DbClient.md (100%) rename ENG-08-2-Database-Transaction.md => ENG/ENG-08-2-Database-Transaction.md (100%) rename ENG-08-3-Database-ORM.md => ENG/ENG-08-3-Database-ORM.md (100%) rename ENG-08-4-Database-FastDbClient.md => ENG/ENG-08-4-Database-FastDbClient.md (100%) rename ENG-08-5-Database-auto_batch.md => ENG/ENG-08-5-Database-auto_batch.md (100%) rename ENG-09-0-References-request.md => ENG/ENG-09-0-References-request.md (100%) rename ENG-09-1-File-Handler.md => ENG/ENG-09-1-File-Handler.md (100%) rename ENG-10-Plugins.md => ENG/ENG-10-Plugins.md (100%) rename ENG-11-Configuration-File.md => ENG/ENG-11-Configuration-File.md (100%) rename ENG-12-drogon_ctl-Command.md => ENG/ENG-12-drogon_ctl-Command.md (100%) rename ENG-13-AOP-Aspect-Oriented-Programming.md => ENG/ENG-13-AOP-Aspect-Oriented-Programming.md (100%) rename ENG-14-Benchmarks.md => ENG/ENG-14-Benchmarks.md (100%) rename ENG-15-Coz.md => ENG/ENG-15-Coz.md (100%) rename ENG-16-Brotli.md => ENG/ENG-16-Brotli.md (100%) rename ENG-17-Coroutines.md => ENG/ENG-17-Coroutines.md (100%) rename ENG-18-Redis.md => ENG/ENG-18-Redis.md (100%) rename ENG-19-Testing-Framework.md => ENG/ENG-19-Testing-Framework.md (100%) rename ENG-FAQ-1-Understanding-drogon-threading-model.md => ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md (100%) rename ENG-FAQ.md => ENG/ENG-FAQ.md (100%) rename Home.md => ENG/Home.md (100%) diff --git "a/CHN-01-\346\246\202\350\277\260.md" "b/CHN/CHN-01-\346\246\202\350\277\260.md" similarity index 100% rename from "CHN-01-\346\246\202\350\277\260.md" rename to "CHN/CHN-01-\346\246\202\350\277\260.md" diff --git "a/CHN-02-\345\256\211\350\243\205.md" "b/CHN/CHN-02-\345\256\211\350\243\205.md" similarity index 100% rename from "CHN-02-\345\256\211\350\243\205.md" rename to "CHN/CHN-02-\345\256\211\350\243\205.md" diff --git "a/CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" "b/CHN/CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" similarity index 100% rename from "CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" rename to "CHN/CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" diff --git "a/CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" "b/CHN/CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" similarity index 100% rename from "CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" rename to "CHN/CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" diff --git "a/CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" "b/CHN/CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" similarity index 100% rename from "CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" rename to "CHN/CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" diff --git "a/CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" "b/CHN/CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" similarity index 100% rename from "CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" rename to "CHN/CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" diff --git "a/CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" "b/CHN/CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" similarity index 100% rename from "CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" rename to "CHN/CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" diff --git "a/CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" "b/CHN/CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" similarity index 100% rename from "CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" rename to "CHN/CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" diff --git "a/CHN-06-\350\247\206\345\233\276.md" "b/CHN/CHN-06-\350\247\206\345\233\276.md" similarity index 100% rename from "CHN-06-\350\247\206\345\233\276.md" rename to "CHN/CHN-06-\350\247\206\345\233\276.md" diff --git "a/CHN-07-\344\274\232\350\257\235.md" "b/CHN/CHN-07-\344\274\232\350\257\235.md" similarity index 100% rename from "CHN-07-\344\274\232\350\257\235.md" rename to "CHN/CHN-07-\344\274\232\350\257\235.md" diff --git "a/CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" "b/CHN/CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" similarity index 100% rename from "CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" rename to "CHN/CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" diff --git "a/CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" "b/CHN/CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" similarity index 100% rename from "CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" rename to "CHN/CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" diff --git "a/CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" "b/CHN/CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" similarity index 100% rename from "CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" rename to "CHN/CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" diff --git "a/CHN-08-3-\346\225\260\346\215\256\345\272\223-ORM.md" "b/CHN/CHN-08-3-\346\225\260\346\215\256\345\272\223-ORM.md" similarity index 100% rename from "CHN-08-3-\346\225\260\346\215\256\345\272\223-ORM.md" rename to "CHN/CHN-08-3-\346\225\260\346\215\256\345\272\223-ORM.md" diff --git "a/CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" "b/CHN/CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" similarity index 100% rename from "CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" rename to "CHN/CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" diff --git "a/CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" "b/CHN/CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" similarity index 100% rename from "CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" rename to "CHN/CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" diff --git "a/CHN-09-\346\217\222\344\273\266.md" "b/CHN/CHN-09-\346\217\222\344\273\266.md" similarity index 100% rename from "CHN-09-\346\217\222\344\273\266.md" rename to "CHN/CHN-09-\346\217\222\344\273\266.md" diff --git "a/CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" "b/CHN/CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" similarity index 100% rename from "CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" rename to "CHN/CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" diff --git "a/CHN-11-drogon_ctl\345\221\275\344\273\244.md" "b/CHN/CHN-11-drogon_ctl\345\221\275\344\273\244.md" similarity index 100% rename from "CHN-11-drogon_ctl\345\221\275\344\273\244.md" rename to "CHN/CHN-11-drogon_ctl\345\221\275\344\273\244.md" diff --git "a/CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" "b/CHN/CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" similarity index 100% rename from "CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" rename to "CHN/CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" diff --git "a/CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" "b/CHN/CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" similarity index 100% rename from "CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" rename to "CHN/CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" diff --git "a/CHN-14-Coz\345\210\206\346\236\220.md" "b/CHN/CHN-14-Coz\345\210\206\346\236\220.md" similarity index 100% rename from "CHN-14-Coz\345\210\206\346\236\220.md" rename to "CHN/CHN-14-Coz\345\210\206\346\236\220.md" diff --git "a/CHN-15-Brotli\345\216\213\347\274\251.md" "b/CHN/CHN-15-Brotli\345\216\213\347\274\251.md" similarity index 100% rename from "CHN-15-Brotli\345\216\213\347\274\251.md" rename to "CHN/CHN-15-Brotli\345\216\213\347\274\251.md" diff --git "a/CHN-16-\345\215\217\347\250\213.md" "b/CHN/CHN-16-\345\215\217\347\250\213.md" similarity index 100% rename from "CHN-16-\345\215\217\347\250\213.md" rename to "CHN/CHN-16-\345\215\217\347\250\213.md" diff --git a/CHN-17-Redis.md b/CHN/CHN-17-Redis.md similarity index 100% rename from CHN-17-Redis.md rename to CHN/CHN-17-Redis.md diff --git "a/CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" "b/CHN/CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" similarity index 100% rename from "CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" rename to "CHN/CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" diff --git "a/CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" "b/CHN/CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" similarity index 100% rename from "CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" rename to "CHN/CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" diff --git a/CHN-FAQ.md b/CHN/CHN-FAQ.md similarity index 100% rename from CHN-FAQ.md rename to CHN/CHN-FAQ.md diff --git a/Home.zh-CN.md b/CHN/Home.zh-CN.md similarity index 100% rename from Home.zh-CN.md rename to CHN/Home.zh-CN.md diff --git a/ENG-01-Overview.md b/ENG/ENG-01-Overview.md similarity index 100% rename from ENG-01-Overview.md rename to ENG/ENG-01-Overview.md diff --git a/ENG-02-Installation.md b/ENG/ENG-02-Installation.md similarity index 100% rename from ENG-02-Installation.md rename to ENG/ENG-02-Installation.md diff --git a/ENG-03-Quick-Start.md b/ENG/ENG-03-Quick-Start.md similarity index 100% rename from ENG-03-Quick-Start.md rename to ENG/ENG-03-Quick-Start.md diff --git a/ENG-04-0-Controller-Introduction.md b/ENG/ENG-04-0-Controller-Introduction.md similarity index 100% rename from ENG-04-0-Controller-Introduction.md rename to ENG/ENG-04-0-Controller-Introduction.md diff --git a/ENG-04-1-Controller-HttpSimpleController.md b/ENG/ENG-04-1-Controller-HttpSimpleController.md similarity index 100% rename from ENG-04-1-Controller-HttpSimpleController.md rename to ENG/ENG-04-1-Controller-HttpSimpleController.md diff --git a/ENG-04-2-Controller-HttpController.md b/ENG/ENG-04-2-Controller-HttpController.md similarity index 100% rename from ENG-04-2-Controller-HttpController.md rename to ENG/ENG-04-2-Controller-HttpController.md diff --git a/ENG-04-3-Controller-WebSocketController.md b/ENG/ENG-04-3-Controller-WebSocketController.md similarity index 100% rename from ENG-04-3-Controller-WebSocketController.md rename to ENG/ENG-04-3-Controller-WebSocketController.md diff --git a/ENG-05-Middleware-and-Filter.md b/ENG/ENG-05-Middleware-and-Filter.md similarity index 100% rename from ENG-05-Middleware-and-Filter.md rename to ENG/ENG-05-Middleware-and-Filter.md diff --git a/ENG-06-View.md b/ENG/ENG-06-View.md similarity index 100% rename from ENG-06-View.md rename to ENG/ENG-06-View.md diff --git a/ENG-07-Session.md b/ENG/ENG-07-Session.md similarity index 100% rename from ENG-07-Session.md rename to ENG/ENG-07-Session.md diff --git a/ENG-08-0-Database-General.md b/ENG/ENG-08-0-Database-General.md similarity index 100% rename from ENG-08-0-Database-General.md rename to ENG/ENG-08-0-Database-General.md diff --git a/ENG-08-1-Database-DbClient.md b/ENG/ENG-08-1-Database-DbClient.md similarity index 100% rename from ENG-08-1-Database-DbClient.md rename to ENG/ENG-08-1-Database-DbClient.md diff --git a/ENG-08-2-Database-Transaction.md b/ENG/ENG-08-2-Database-Transaction.md similarity index 100% rename from ENG-08-2-Database-Transaction.md rename to ENG/ENG-08-2-Database-Transaction.md diff --git a/ENG-08-3-Database-ORM.md b/ENG/ENG-08-3-Database-ORM.md similarity index 100% rename from ENG-08-3-Database-ORM.md rename to ENG/ENG-08-3-Database-ORM.md diff --git a/ENG-08-4-Database-FastDbClient.md b/ENG/ENG-08-4-Database-FastDbClient.md similarity index 100% rename from ENG-08-4-Database-FastDbClient.md rename to ENG/ENG-08-4-Database-FastDbClient.md diff --git a/ENG-08-5-Database-auto_batch.md b/ENG/ENG-08-5-Database-auto_batch.md similarity index 100% rename from ENG-08-5-Database-auto_batch.md rename to ENG/ENG-08-5-Database-auto_batch.md diff --git a/ENG-09-0-References-request.md b/ENG/ENG-09-0-References-request.md similarity index 100% rename from ENG-09-0-References-request.md rename to ENG/ENG-09-0-References-request.md diff --git a/ENG-09-1-File-Handler.md b/ENG/ENG-09-1-File-Handler.md similarity index 100% rename from ENG-09-1-File-Handler.md rename to ENG/ENG-09-1-File-Handler.md diff --git a/ENG-10-Plugins.md b/ENG/ENG-10-Plugins.md similarity index 100% rename from ENG-10-Plugins.md rename to ENG/ENG-10-Plugins.md diff --git a/ENG-11-Configuration-File.md b/ENG/ENG-11-Configuration-File.md similarity index 100% rename from ENG-11-Configuration-File.md rename to ENG/ENG-11-Configuration-File.md diff --git a/ENG-12-drogon_ctl-Command.md b/ENG/ENG-12-drogon_ctl-Command.md similarity index 100% rename from ENG-12-drogon_ctl-Command.md rename to ENG/ENG-12-drogon_ctl-Command.md diff --git a/ENG-13-AOP-Aspect-Oriented-Programming.md b/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md similarity index 100% rename from ENG-13-AOP-Aspect-Oriented-Programming.md rename to ENG/ENG-13-AOP-Aspect-Oriented-Programming.md diff --git a/ENG-14-Benchmarks.md b/ENG/ENG-14-Benchmarks.md similarity index 100% rename from ENG-14-Benchmarks.md rename to ENG/ENG-14-Benchmarks.md diff --git a/ENG-15-Coz.md b/ENG/ENG-15-Coz.md similarity index 100% rename from ENG-15-Coz.md rename to ENG/ENG-15-Coz.md diff --git a/ENG-16-Brotli.md b/ENG/ENG-16-Brotli.md similarity index 100% rename from ENG-16-Brotli.md rename to ENG/ENG-16-Brotli.md diff --git a/ENG-17-Coroutines.md b/ENG/ENG-17-Coroutines.md similarity index 100% rename from ENG-17-Coroutines.md rename to ENG/ENG-17-Coroutines.md diff --git a/ENG-18-Redis.md b/ENG/ENG-18-Redis.md similarity index 100% rename from ENG-18-Redis.md rename to ENG/ENG-18-Redis.md diff --git a/ENG-19-Testing-Framework.md b/ENG/ENG-19-Testing-Framework.md similarity index 100% rename from ENG-19-Testing-Framework.md rename to ENG/ENG-19-Testing-Framework.md diff --git a/ENG-FAQ-1-Understanding-drogon-threading-model.md b/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md similarity index 100% rename from ENG-FAQ-1-Understanding-drogon-threading-model.md rename to ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md diff --git a/ENG-FAQ.md b/ENG/ENG-FAQ.md similarity index 100% rename from ENG-FAQ.md rename to ENG/ENG-FAQ.md diff --git a/Home.md b/ENG/Home.md similarity index 100% rename from Home.md rename to ENG/Home.md From e98075128f3a0166cbfdeb788611c72c4814f095 Mon Sep 17 00:00:00 2001 From: Chuck <32836622+chuckn408@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:42:37 -0700 Subject: [PATCH 2/7] Fix Broken Localization Links Fix Broken Localization Links --- ENG/ENG-01-Overview.md | 4 +- ENG/ENG-02-Installation.md | 4 +- ENG/ENG-03-Quick-Start.md | 8 +- ENG/ENG-04-0-Controller-Introduction.md | 6 +- ...NG-04-1-Controller-HttpSimpleController.md | 6 +- ENG/ENG-04-2-Controller-HttpController.md | 4 +- ...ENG-04-3-Controller-WebSocketController.md | 6 +- ENG/ENG-05-Middleware-and-Filter.md | 8 +- ENG/ENG-06-View.md | 4 +- ENG/ENG-07-Session.md | 4 +- ENG/ENG-08-0-Database-General.md | 12 +- ENG/ENG-08-1-Database-DbClient.md | 6 +- ENG/ENG-08-2-Database-Transaction.md | 4 +- ENG/ENG-08-3-Database-ORM.md | 8 +- ENG/ENG-08-4-Database-FastDbClient.md | 6 +- ENG/ENG-08-5-Database-auto_batch.md | 4 +- ENG/ENG-09-0-References-request.md | 6 +- ENG/ENG-09-1-File-Handler.md | 2 +- ENG/ENG-10-Plugins.md | 4 +- ENG/ENG-11-Configuration-File.md | 12 +- ENG/ENG-12-drogon_ctl-Command.md | 10 +- ENG/ENG-13-AOP-Aspect-Oriented-Programming.md | 4 +- ENG/ENG-14-Benchmarks.md | 4 +- ENG/ENG-15-Coz.md | 4 +- ENG/ENG-16-Brotli.md | 4 +- ENG/ENG-17-Coroutines.md | 4 +- ENG/ENG-18-Redis.md | 6 +- ENG/ENG-19-Testing-Framework.md | 2 +- ...-1-Understanding-drogon-threading-model.md | 2 +- ENG/ENG-FAQ.md | 4 +- ENG/Home.md | 152 +++++++++--------- 31 files changed, 157 insertions(+), 157 deletions(-) diff --git a/ENG/ENG-01-Overview.md b/ENG/ENG-01-Overview.md index 4004225..7bd22a2 100644 --- a/ENG/ENG-01-Overview.md +++ b/ENG/ENG-01-Overview.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-01-概述) +##### Other languages: [简体中文](/CHN//CHN/CHN-01-概述) **Drogon** is a C++17/20-based HTTP application framework. Drogon can be used to easily build various types of web application server programs using C++. @@ -31,4 +31,4 @@ Its main features are as follows: * Support plugins which can be installed by the configuration file at load time; * Support AOP with build-in joinpoints. -# Next: [Install drogon](ENG-02-Installation) +# Next: [Install drogon](/ENG//ENG/ENG-02-Installation) diff --git a/ENG/ENG-02-Installation.md b/ENG/ENG-02-Installation.md index 4a93eb1..b5c1678 100644 --- a/ENG/ENG-02-Installation.md +++ b/ENG/ENG-02-Installation.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-02-安装) +##### Other languages: [简体中文](/CHN//CHN/CHN-02-安装) This section takes Ubuntu 18.04, CentOS 7.5, MacOS 12.2 as an example to introduce the installation process. Other systems are similar; @@ -481,4 +481,4 @@ Assuming that the above environment and library dependencies are all ready, the target_link_libraries(${PROJECT_NAME} PRIVATE drogon) ``` -# Next: [Quick Start](ENG-03-Quick-Start) +# Next: [Quick Start](/ENG//ENG/ENG-03-Quick-Start) diff --git a/ENG/ENG-03-Quick-Start.md b/ENG/ENG-03-Quick-Start.md index 0544c1e..224fbd4 100644 --- a/ENG/ENG-03-Quick-Start.md +++ b/ENG/ENG-03-Quick-Start.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-03-快速开始) +##### Other languages: [简体中文](/CHN//CHN/CHN-03-快速开始) ## Static Site @@ -22,7 +22,7 @@ There are several useful folders in the project directory already: └── views The folder where view csp files are stored ``` -Users can put various files (such as controllers, filters, views, etc.) into the corresponding folders. For more convenience and less error, we strongly recommend that users create their own web application projects using the `drogon_ctl` command. See [drogon_ctl](ENG-11-drogon_ctl-Command) for more details. +Users can put various files (such as controllers, filters, views, etc.) into the corresponding folders. For more convenience and less error, we strongly recommend that users create their own web application projects using the `drogon_ctl` command. See [drogon_ctl](/ENG/ENG-11-drogon_ctl-Command) for more details. Let's look at the main.cc file: @@ -55,7 +55,7 @@ Now, we simply add one static file index.html to the Http root path: echo '

Hello Drogon!

' >>index.html ``` -The default root path is `"./"`, but could also be modified by config.json. See [Configuration File](ENG-10-Configuration-File) for more details. Then you can visit this page by URL `"http://localhost"` or`"http://localhost/index.html"` (or the IP of the server where your wepapp is running). +The default root path is `"./"`, but could also be modified by config.json. See [Configuration File](/ENG/ENG-10-Configuration-File) for more details. Then you can visit this page by URL `"http://localhost"` or`"http://localhost/index.html"` (or the IP of the server where your wepapp is running). ![Hello Drogon!](images/hellodrogon.png) @@ -194,4 +194,4 @@ We see that adding a controller to an application is very simple. You only need > **Note: Drogon has no restrictions on the location of the controller source files. You could also save them in "./" (the project root directory), or you could even define a new directory in `CMakeLists.txt`. It is recommended to use the controllers directory for the convenience of management.** -# Next: [drogon_ctl Command](ENG-04-0-Controller-Introduction) +# Next: [drogon_ctl Command](/ENG/ENG-04-0-Controller-Introduction) diff --git a/ENG/ENG-04-0-Controller-Introduction.md b/ENG/ENG-04-0-Controller-Introduction.md index 12da899..ca7fd0a 100644 --- a/ENG/ENG-04-0-Controller-Introduction.md +++ b/ENG/ENG-04-0-Controller-Introduction.md @@ -1,6 +1,6 @@ -##### Other languages: [简体中文](CHN-04-控制器-简介) +##### Other languages: [简体中文](/CHN/CHN-04-控制器-简介) -The controller is very important in web application development. This is where we will define our URLs, which HTTP methods are allowed, which [filters](ENG-06-Middleware-and-Filter) will be applied and how requests will be processed and responded to. The drogon framework has helped us to handle the network transmission, Http protocol analysis and so on. We only need to pay attention to the logic of the controller; each controller object can have one or more processing functions (generally called handlers), and the interface of the function is generally defined as follows: +The controller is very important in web application development. This is where we will define our URLs, which HTTP methods are allowed, which [filters](/ENG/ENG-06-Middleware-and-Filter) will be applied and how requests will be processed and responded to. The drogon framework has helped us to handle the network transmission, Http protocol analysis and so on. We only need to pay attention to the logic of the controller; each controller object can have one or more processing functions (generally called handlers), and the interface of the function is generally defined as follows: ```c++ Void handlerName(const HttpRequestPtr &req, @@ -33,4 +33,4 @@ public: A controller registered to a drogon framework will have at most only one instance and will not be destroyed during the entire application run, so users can declare and use member variables in the controller class. Note that when the handler of the controller is called, it is in a multi-threaded environment (when the number of IO threads of the framework is configured to be greater than 1), if you need to access non-temporary variables, please do the concurrent protection work. -# Next: [HttpSimpleController](ENG-04-1-Controller-HttpSimpleController) +# Next: [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) diff --git a/ENG/ENG-04-1-Controller-HttpSimpleController.md b/ENG/ENG-04-1-Controller-HttpSimpleController.md index f372c37..db4afa9 100644 --- a/ENG/ENG-04-1-Controller-HttpSimpleController.md +++ b/ENG/ENG-04-1-Controller-HttpSimpleController.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-04-1-控制器-HttpSimpleController) +##### Other languages: [简体中文](/CHN/CHN-04-1-控制器-HttpSimpleController) You could use the `drogon_ctl` command line tool to quickly generate custom controller class source files based on `HttpSimpleController`. The command format is as bellow: @@ -47,7 +47,7 @@ Each HttpSimpleController class can only define one Http request handler, and it The route (or called mapping) from the URL path to the handler is done by a macro. You could add multipath mappings with the `PATH_ADD` macro. All `PATH_ADD` statements should be set between the `PATH_LIST_BEGIN` and `PATH_LIST_END` macro statements. -The first parameter is the path to be mapped, and parameters beyond the path are constraints on this path. Currently, two types of constraints are supported. One is the `HttpMethod` enum Type, which means the Http method allowed. The other type is the name of the `HttpFilter` class. One can configure any number of these two types of constraints, and there are no order requirements for them. For Filter, please refer to [Middleware and Filter](ENG-05-Middleware-and-Filter). +The first parameter is the path to be mapped, and parameters beyond the path are constraints on this path. Currently, two types of constraints are supported. One is the `HttpMethod` enum Type, which means the Http method allowed. The other type is the name of the `HttpFilter` class. One can configure any number of these two types of constraints, and there are no order requirements for them. For Filter, please refer to [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter). Users can register the same Simple Controller to multiple paths, or register multiple Simple Controllers on the same path (using different HTTP methods). @@ -64,4 +64,4 @@ You could define an HttpResponse class variable, and then use the callback() to > **The mapping from the above path to the handler is done at compile time. In fact, the drogon framework also provides an interface for runtime completion mapping. The runtime mapping allows the user to map or modify the mapping through configuration files or other user interfaces without recompiling this program (For performance reasons, it is forbidden to add any controller mapping after running the app().run() method).** -# Next: [HttpController](ENG-04-2-Controller-HttpController) +# Next: [HttpController](/ENG/ENG-04-2-Controller-HttpController) diff --git a/ENG/ENG-04-2-Controller-HttpController.md b/ENG/ENG-04-2-Controller-HttpController.md index 01c0cdf..c5b9177 100644 --- a/ENG/ENG-04-2-Controller-HttpController.md +++ b/ENG/ENG-04-2-Controller-HttpController.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-04-2-控制器-HttpController) +##### Other languages: [简体中文](/CHN/CHN-04-2-控制器-HttpController) ### Generation @@ -279,4 +279,4 @@ Each `HttpController` class can define many Http request handlers. Since the num > **It should be noted that when using regular expressions, you should pay attention to matching conflicts (multiple different handlers are matched). When conflicts happen in the same controller, drogon will only execute the first handler (the one registered in the framework first). When conflicts happen between different controllers, it is uncertain which handler will be executed. Therefore, users need to avoid these conflicts.** -# Next: [WebSocketController](ENG-04-3-Controller-WebSocketController) +# Next: [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) diff --git a/ENG/ENG-04-3-Controller-WebSocketController.md b/ENG/ENG-04-3-Controller-WebSocketController.md index 1fc7842..2d62efe 100644 --- a/ENG/ENG-04-3-Controller-WebSocketController.md +++ b/ENG/ENG-04-3-Controller-WebSocketController.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-04-3-控制器-WebSocketController) +##### Other languages: [简体中文](/CHN/CHN-04-3-控制器-WebSocketController) As the name implies, `WebSocketController` is used to process websocket logic. Websocket is a persistent HTTP-based connection scheme. At the beginning of the websocket, there is an HTTP format request and response exchange. After the websocket connection is established, all messages are transmitted on the websocket. The message is wrapped in a fixed format. There is no limit to the message content and the order in which messages are transmitted. @@ -100,7 +100,7 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr } ``` - First, in this example, the controller is registered to the `/echo` path via the `WS_PATH_ADD` macro. The usage of the `WS_PATH_ADD` macro is similar to the macros of other controllers introduced earlier. One can also register the path with several [Filters](ENG-05-Middleware-and-Filter). Since websocket is handled separately in the framework, it can be repeated with the paths of the first two controllers(`HttpSimpleController` and `HttpApiController`) without affecting each other. + First, in this example, the controller is registered to the `/echo` path via the `WS_PATH_ADD` macro. The usage of the `WS_PATH_ADD` macro is similar to the macros of other controllers introduced earlier. One can also register the path with several [Filters](/ENG/ENG-05-Middleware-and-Filter). Since websocket is handled separately in the framework, it can be repeated with the paths of the first two controllers(`HttpSimpleController` and `HttpApiController`) without affecting each other. Secondly, in the implementation of the three virtual functions in this example, only the handleNewMessage has the substance, but simply sends the received message back to the client through the send interface.Compile this controller into the framework, you can see the effect, please test it yourself. @@ -150,4 +150,4 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr any *getMutableContext(); ``` -# Next: [Middleware and Filter](ENG-05-Middleware-and-Filter) +# Next: [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) diff --git a/ENG/ENG-05-Middleware-and-Filter.md b/ENG/ENG-05-Middleware-and-Filter.md index 933a7cd..92b8d04 100644 --- a/ENG/ENG-05-Middleware-and-Filter.md +++ b/ENG/ENG-05-Middleware-and-Filter.md @@ -1,6 +1,6 @@ -##### Other languages: [简体中文](CHN-05-中间件和过滤器) +##### Other languages: [简体中文](/CHN/CHN-05-中间件和过滤器) -In HttpController's [example](ENG-04-2-Controller-HttpController), the getInfo method should check whether the user is logged in before returning the user's information. We can write this logic in the getInfo method, but obviously, checking the user's login membership is general logic which will be used by many interfaces, it should be extracted separately and configured before calling handler, which is what filters do. +In HttpController's [example](/ENG/ENG-04-2-Controller-HttpController), the getInfo method should check whether the user is logged in before returning the user's information. We can write this logic in the getInfo method, but obviously, checking the user's login membership is general logic which will be used by many interfaces, it should be extracted separately and configured before calling handler, which is what filters do. Drogon's middleware uses the onion model. After the framework completes URL path matching, it sequentially invokes the middleware registered for that path. Within each middleware, users can choose to intercept or pass through the request and add pre-processing and post-processing logic. @@ -71,7 +71,7 @@ Drogon contains the following common filters: }; ``` - You could create filter by the `drogon_ctl` command, see [drogon_ctl](ENG-11-drogon_ctl-command#Filter-creation). + You could create filter by the `drogon_ctl` command, see [drogon_ctl](/ENG/ENG-11-drogon_ctl-command#Filter-creation). You need to override the doFilter virtual function of the parent class to implement the filter logic; @@ -100,4 +100,4 @@ Drogon contains the following common filters: > **Note: If the middleware/filter is defined in the namespace, you must write the namespace completely when you register it.** -# Next: [View](ENG-06-View) +# Next: [View](/ENG/ENG-06-View) diff --git a/ENG/ENG-06-View.md b/ENG/ENG-06-View.md index 3c77038..628de19 100644 --- a/ENG/ENG-06-View.md +++ b/ENG/ENG-06-View.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-06-视图) +##### Other languages: [简体中文](/CHN/CHN-06-视图) ### Views Introduction @@ -151,4 +151,4 @@ Obviously, this function depends on the development environment. If both drogon > **Note: If a `symbol not found` error occurs while loading a dynamic view, please use the `cmake .. -DCMAKE_ENABLE_EXPORTS=on` to configure your project, or uncomment the last line (`set_property(TARGET ${PROJECT_NAME} PROPERTY ENABLE_EXPORTS ON)`) in your project's CMakeLists.txt, and then rebuild the project** -# Next: [Session](ENG-07-Session) +# Next: [Session](/ENG/ENG-07-Session) diff --git a/ENG/ENG-07-Session.md b/ENG/ENG-07-Session.md index a403c16..8eee5ab 100644 --- a/ENG/ENG-07-Session.md +++ b/ENG/ENG-07-Session.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-07-会话) +##### Other languages: [简体中文](/CHN/CHN-07-会话) `Session` is an important concept of the web application. It is used to save the state of the client on the server. Generally, it cooperates with the browser's `cookie`, and drogon provides support for the session. Drogon **close** the session selection by default, you can also close or open it through the following interface: @@ -96,4 +96,4 @@ drogon::HttpAppFramework::instance().enableSession(1200); Recompile the entire project with CMake, run the target program webapp, and you can see the effect through the browser. -# Next: [Database](ENG-08-0-Database-General) +# Next: [Database](/ENG/ENG-08-0-Database-General) diff --git a/ENG/ENG-08-0-Database-General.md b/ENG/ENG-08-0-Database-General.md index cf9558d..928d278 100644 --- a/ENG/ENG-08-0-Database-General.md +++ b/ENG/ENG-08-0-Database-General.md @@ -1,8 +1,8 @@ -##### Other languages: [简体中文](CHN-08-0-数据库-概述) +##### Other languages: [简体中文](/CHN/CHN-08-0-数据库-概述) ### General -**Drogon** has built-in database read/write engine. The operation of database connection is based on non-blocking I/O technology. Therefore, the application works in an efficient non-blocking asynchronous mode from the bottom to the upper layer, which ensures Drogon's high concurrency performance. Currently, Drogon supports PostgreSQL and MySQL databases. If you want to use a database, the development environment of the corresponding database must be installed first. Drogon will automatically detect the header files and library files of these libraries and compile the corresponding parts. For the preparation of the database development environment, see [Development Environment](ENG-02-Installation#Database-Environment). +**Drogon** has built-in database read/write engine. The operation of database connection is based on non-blocking I/O technology. Therefore, the application works in an efficient non-blocking asynchronous mode from the bottom to the upper layer, which ensures Drogon's high concurrency performance. Currently, Drogon supports PostgreSQL and MySQL databases. If you want to use a database, the development environment of the corresponding database must be installed first. Drogon will automatically detect the header files and library files of these libraries and compile the corresponding parts. For the preparation of the database development environment, see [Development Environment](/ENG/ENG-02-Installation#Database-Environment). **Drogon** supports the sqlite3 database in order to support lightweight applications. The asynchronous interface is implemented through the thread pool, which is the same as the interfaces of the aforementioned databases. @@ -14,14 +14,14 @@ The basic class of Drogon's database is `DbClient` (this is an abstract class, t Usually, when an asynchronous interface is called, `DbClient` will randomly select one of the idle connections it manages to perform related query operations. When the result returns, `DbClient` will process the data and return it to the caller through the callback function object; Without an idle connection, the execution content will be cached. Once a connection has executed its own sql request, the pending command will be fetched from the cache to execute. -For details on `DbClient`, see [DbClient](ENG-08-1-Database-DbClient). +For details on `DbClient`, see [DbClient](/ENG/ENG-08-1-Database-DbClient). ### Transaction -The transaction object can be generated by `DbClient` to support transaction operations. In addition to the extra `rollback()` interface, the transaction object is basically the same as `DbClient`. The transaction class is `Transaction`. For details of the `Transaction` class, see [Transaction](ENG-08-2-Database-Transaction). +The transaction object can be generated by `DbClient` to support transaction operations. In addition to the extra `rollback()` interface, the transaction object is basically the same as `DbClient`. The transaction class is `Transaction`. For details of the `Transaction` class, see [Transaction](/ENG/ENG-08-2-Database-Transaction). ### ORM -Drogon also provides support for **ORM**. Users can use the drogon_ctl command to read the tables in the database and generate the corresponding model source code. Then, execute the database operations of these models through the `Mapper` class template. Mapper provides simple and convenient interfaces for standard database operations, allowing users to make the additions, deletions, and changes to the table without writing sql statements. For **ORM**, please refer to [ORM](ENG-08-3-Database-ORM) +Drogon also provides support for **ORM**. Users can use the drogon_ctl command to read the tables in the database and generate the corresponding model source code. Then, execute the database operations of these models through the `Mapper` class template. Mapper provides simple and convenient interfaces for standard database operations, allowing users to make the additions, deletions, and changes to the table without writing sql statements. For **ORM**, please refer to [ORM](/ENG/ENG-08-3-Database-ORM) -# Next: [DbClient](ENG-08-1-Database-DbClient) +# Next: [DbClient](/ENG/ENG-08-1-Database-DbClient) diff --git a/ENG/ENG-08-1-Database-DbClient.md b/ENG/ENG-08-1-Database-DbClient.md index b687892..e0f2f98 100644 --- a/ENG/ENG-08-1-Database-DbClient.md +++ b/ENG/ENG-08-1-Database-DbClient.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-08-1-数据库-DbClient) +##### Other languages: [简体中文](/CHN/CHN-08-1-数据库-DbClient) ### DbClient Object Construction @@ -20,7 +20,7 @@ The object obtained by the above method, the user has to find a way to persist i - This will waste time creating connections and disconnections, increasing system latency; - The interface is also a non-blocking interface. That is to say, when the user gets the DbClient object, the connection managed by the it has not been established yet. The framework does not (intentionally) provide a callback interface for successful connection establishment. Do you still have to sleep before starting the query?? This is contrary to the original intention of the asynchronous framework. -Therefore, DbClient objects should be built at the beginning of the program and held and used throughout the life time. Obviously, this work can be done entirely by the framework. So the drogon framework provides the second build method, which is built by configuration file or the `createDbClient()` method. For the configuration method of the configuration file, see [db_clients](ENG-10-Configuration-file#db_clients). +Therefore, DbClient objects should be built at the beginning of the program and held and used throughout the life time. Obviously, this work can be done entirely by the framework. So the drogon framework provides the second build method, which is built by configuration file or the `createDbClient()` method. For the configuration method of the configuration file, see [db_clients](/ENG/ENG-10-Configuration-file#db_clients). When needed, the DbClient smart pointer is obtained through the interface of the framework. The interface is as follows: @@ -253,4 +253,4 @@ Each DbClient object has one or multiple its own EventLoop threads controlling t Blocking interfaces of DbClient only block the caller thread, as long as the caller thread is not the EventLoop thread, it will not affect the normal operation of the EventLoop thread. When the callback function is called, the program inside the callback is run on the EventLoop thread. Therefore, do not perform any blocking operations within the callback, otherwise it will affect the concurrency performance of database read and write. Anyone familiar with non-blocking I/O programming should understand this constraint. -# Next: [Transaction](ENG-08-2-Database-Transaction) +# Next: [Transaction](/ENG/ENG-08-2-Database-Transaction) diff --git a/ENG/ENG-08-2-Database-Transaction.md b/ENG/ENG-08-2-Database-Transaction.md index 104bfee..6112d6a 100644 --- a/ENG/ENG-08-2-Database-Transaction.md +++ b/ENG/ENG-08-2-Database-Transaction.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-08-2-数据库-事务) +##### Other languages: [简体中文](/CHN/CHN-08-2-数据库-事务) > **Transactions** are an important feature of relational databases, and Drogon provides transaction support with the `Transaction` class. @@ -83,4 +83,4 @@ For the simplest example, suppose there is a task table from which the user sele In this case, select for update is used to avoid concurrent modifications. The update statement is completed in the result callback of the select statement. The outermost braces are used to limit the scope of the transPtr so that it can be destroyed in time after the execution of sql to end the transaction. -# Next: [ORM](ENG-08-3-Database-ORM) +# Next: [ORM](/ENG/ENG-08-3-Database-ORM) diff --git a/ENG/ENG-08-3-Database-ORM.md b/ENG/ENG-08-3-Database-ORM.md index 6097a78..cd0e9d0 100644 --- a/ENG/ENG-08-3-Database-ORM.md +++ b/ENG/ENG-08-3-Database-ORM.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-08-3-数据库-ORM) +##### Other languages: [简体中文](/CHN/CHN-08-3-数据库-ORM) ### Model @@ -30,7 +30,7 @@ The last parameter is the path to store model classes. There must be a configura } ``` -The configured parameters are the same as the application's configuration file. Please refer to [Configuration File](ENG-10-Configuration-File#db_clients). +The configured parameters are the same as the application's configuration file. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). The `tables` configuration option is unique to the model configuration. It is an array of strings. Each string represents the name of the table to be converted into a model class. If this option is empty, all tables will be used to generate model classes. @@ -99,7 +99,7 @@ template explicit Criteria(const CustomSql &sql, Arguments &&...args) ``` -The first argument is a `CustomSql` object of sql statements with `$?` placeholders, while the `CustomSql` class is just a wrapper of a std::string. The second indefinite argument is a parameter pack represents the bound parameter, which behaves just like the ones in [execSqlAsync](ENG-08-1-Database-DbClient.md#execSqlAsync). +The first argument is a `CustomSql` object of sql statements with `$?` placeholders, while the `CustomSql` class is just a wrapper of a std::string. The second indefinite argument is a parameter pack represents the bound parameter, which behaves just like the ones in [execSqlAsync](/ENG/ENG-08-1-Database-DbClient.md#execSqlAsync). E.g: @@ -286,4 +286,4 @@ drogon_ctl can also generate restful-style controllers for each model (or table) It should be noted that the controller of each table is designed to be composed of a base class and a subclass. Among them, the base class and the table are closely related, and the subclass is used to implement special business logic or modify the interface format. The advantage of this design is that when the table structure changes, users can update only the base class without overwriting the subclass(by setting the `generate_base_only` option to `true`). -# Next: [FastDbClient](ENG-08-4-Database-FastDbClient) +# Next: [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) diff --git a/ENG/ENG-08-4-Database-FastDbClient.md b/ENG/ENG-08-4-Database-FastDbClient.md index 8ea52c1..bc4d82a 100644 --- a/ENG/ENG-08-4-Database-FastDbClient.md +++ b/ENG/ENG-08-4-Database-FastDbClient.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-08-4-数据库-FastDbClient) +##### Other languages: [简体中文](/CHN/CHN-08-4-数据库-FastDbClient) As the name implies, FastDbClient will provide higher performance than the normal DbClient. Unlike DbClient has own event loop, it shares the event loop with network IO threads and the main thread of the web application, which makes the internal implementation of FastDbClient available in a lock-free mode and more efficient. @@ -10,7 +10,7 @@ FastDbClient must be created automatically by the framework with the configurati The sub-option `is_fast` of the db_client option in the configuration file indicates if the client is a FastDbClient.Or user can create a FastDbClient by calling the app.createDbClient() method with the last parameter set to true. -The framework creates a separate FastDbClient for each IO's event loop and the main event loop, and each FastDbClient manages several database connections internally. The number of event loop of IO is controlled by the framework's "threads_num" option, which is generally set to the number of CPU cores of the host. The number of the DB connections per event loop is the value of the DB client "connection_number" option. Please refer to [Configuration File](ENG-10-Configuration-File#db_clients). Therefore, the total number of DB connections held by FastDbClient is `(threads_num+1) * connection_number`. +The framework creates a separate FastDbClient for each IO's event loop and the main event loop, and each FastDbClient manages several database connections internally. The number of event loop of IO is controlled by the framework's "threads_num" option, which is generally set to the number of CPU cores of the host. The number of the DB connections per event loop is the value of the DB client "connection_number" option. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). Therefore, the total number of DB connections held by FastDbClient is `(threads_num+1) * connection_number`. The interface to get a FastDbClient is similar to the normal DbClient, as follows: @@ -30,4 +30,4 @@ The use of FastDbClient is almost identical to that of the normal DbClient, exce - Synchronous transaction creation interfaces are likely to block (when all connections are busy), so FastDbClient's synchronous transaction creation interface returns null pointers directly. If you want to use transactions on FastDbClient, please use the asynchronous transaction creation interface. - After using the FastDbClient to create an Orm Mapper object, you should also use only asynchronous non-blocking interfaces of the mapper object. -# Next: [Automatic batch mode](ENG-08-5-Database-auto_batch) +# Next: [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) diff --git a/ENG/ENG-08-5-Database-auto_batch.md b/ENG/ENG-08-5-Database-auto_batch.md index d2d5e91..8060ccf 100644 --- a/ENG/ENG-08-5-Database-auto_batch.md +++ b/ENG/ENG-08-5-Database-auto_batch.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-08-5-数据库-自动批处理) +##### Other languages: [简体中文](/CHN/CHN-08-5-数据库-自动批处理) The automatic batch mode is only valid for the client library of postgresql 14+ version, and will be ignored in other cases. Before talking about automatic batch processing, let's understand the pipeline mode first. @@ -33,4 +33,4 @@ Therefore, automatic batch mode is helpful to improve performance, but it is not When using the newPgClient interface to create a client, set the third parameter to true to enable automatic batch mode; When using a configuration file to create a client, set the auto_batch option to true to enable automatic batch mode for the client; -# Next: [Request References](ENG-09-0-References-request) +# Next: [Request References](/ENG/ENG-09-0-References-request) diff --git a/ENG/ENG-09-0-References-request.md b/ENG/ENG-09-0-References-request.md index 6a6afa8..ee473d7 100644 --- a/ENG/ENG-09-0-References-request.md +++ b/ENG/ENG-09-0-References-request.md @@ -87,7 +87,7 @@ The HttpRequest type pointer commonly named `req` in the examples in this docume path() #### Summary: - Function that returns the request path. Useful if you use an ADD_METHOD_VIA_REGEX or other type of dynamic URL in the [controller](ENG-04-2-Controller-HttpController). + Function that returns the request path. Useful if you use an ADD_METHOD_VIA_REGEX or other type of dynamic URL in the [controller](/ENG/ENG-04-2-Controller-HttpController). #### Inputs: None. @@ -265,6 +265,6 @@ void mycontroller::postfile(const HttpRequestPtr &req, std::function //create model classes in model_path - #### View creation - The `dg_ctl create view` command is used to generate source files from csp files, see the [View](ENG-07-View) section. In general, this command does not need to be used directly. It is better practice to configure the cmake file to executed this command automatically. The command example is as follows, assuming the csp file is `UsersList.csp`. + The `dg_ctl create view` command is used to generate source files from csp files, see the [View](/ENG/ENG-07-View) section. In general, this command does not need to be used directly. It is better practice to configure the cmake file to executed this command automatically. The command example is as follows, assuming the csp file is `UsersList.csp`. ```shell dg_ctl create view UsersList.csp @@ -95,7 +95,7 @@ drogon_ctl create model //create model classes in model_path - #### Filter creation - The `dg_ctl create filter` command is used to help the user create the source files for filters, see the [Middleware and Filter](ENG-06-Middleware-and-Filter) section. + The `dg_ctl create filter` command is used to help the user create the source files for filters, see the [Middleware and Filter](/ENG/ENG-06-Middleware-and-Filter) section. ```shell dg_ctl create filter LoginFilter @@ -151,7 +151,7 @@ drogon_ctl create model //create model classes in model_path #include "models/User.h" ``` - Note that the models directory name is included to distinguish between multiple data sources in the same project. See [ORM](ENG-08-3-Database-ORM). + Note that the models directory name is included to distinguish between multiple data sources in the same project. See [ORM](/ENG/ENG-08-3-Database-ORM). ### Stress Testing @@ -169,4 +169,4 @@ dg_ctl press -n1000000 -t4 -c1000 -q http://localhost:8080/ dg_ctl press -n 1000000 -t 4 -c 1000 https://www.domain.com/path/to/be/tested ``` -# Next: [Controller Introduction](ENG-05-0-Controller-Introduction) +# Next: [Controller Introduction](/ENG/ENG-05-0-Controller-Introduction) diff --git a/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md b/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md index 5e2ac5b..5653e7b 100644 --- a/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md +++ b/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-12-AOP面向切面编程) +##### Other languages: [简体中文](/CHN/CHN-12-AOP面向切面编程) AOP(Aspect Oriented Programming) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns(Quoted from Wikipedia). @@ -30,4 +30,4 @@ The following figure shows the location of the above four joinpoints in the HTTP ![](images/AOP.png) -# 13 [Benchmarks](ENG-13-Benchmarks) +# 13 [Benchmarks](/ENG/ENG-13-Benchmarks) diff --git a/ENG/ENG-14-Benchmarks.md b/ENG/ENG-14-Benchmarks.md index 34c77ff..63522ee 100644 --- a/ENG/ENG-14-Benchmarks.md +++ b/ENG/ENG-14-Benchmarks.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-13-性能测试) +##### Other languages: [简体中文](/CHN/CHN-13-性能测试) As a C++ Http application framework, performance should be one of the focus of attention. This section introduces Drogon's simple tests and achievements; @@ -47,4 +47,4 @@ The image below is a screenshot of a test: ![Test Result](images/benchmark.png) -# 14 [Causal profiling with coz](ENG-14-Coz) +# 14 [Causal profiling with coz](/ENG/ENG-14-Coz) diff --git a/ENG/ENG-15-Coz.md b/ENG/ENG-15-Coz.md index 5763634..dc47b1c 100644 --- a/ENG/ENG-15-Coz.md +++ b/ENG/ENG-15-Coz.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-14-Coz分析) +##### Other languages: [简体中文](/CHN/CHN-14-Coz分析) ## Causal profiling with coz @@ -23,4 +23,4 @@ For more information checkout: * [Git repo](https://github.com/plasma-umass/coz) * [Coz whitepaper](https://arxiv.org/pdf/1608.03676v1.pdf) -# 15 [Brotli compression](ENG-15-Brotli) +# 15 [Brotli compression](/ENG/ENG-15-Brotli) diff --git a/ENG/ENG-16-Brotli.md b/ENG/ENG-16-Brotli.md index 9d5244b..d4b100c 100644 --- a/ENG/ENG-16-Brotli.md +++ b/ENG/ENG-16-Brotli.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-15-Brotli压缩) +##### Other languages: [简体中文](/CHN/CHN-15-Brotli压缩) ## Brotli Info @@ -13,4 +13,4 @@ if you want to dynamically compress with brotli you'll have to set `use_brotli` Users who don't intend to use brotli static, might want to get rid of brotli extra 'sibling check' by setting `br_static` to `false` in `config.json`. -# 16 [Coroutines](ENG-16-Coroutines) +# 16 [Coroutines](/ENG/ENG-16-Coroutines) diff --git a/ENG/ENG-17-Coroutines.md b/ENG/ENG-17-Coroutines.md index ccfed39..1e068e4 100644 --- a/ENG/ENG-17-Coroutines.md +++ b/ENG/ENG-17-Coroutines.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-16-协程) +##### Other languages: [简体中文](/CHN/CHN-16-协程) Drogon supports [C++ coroutines][1] starting from version 1.4. They provide a way to flatten the control flow of asynchronous calls, i.e. escaping the callback hell. With it, asynchronous programming becomes as easy as synchronous programming. @@ -166,4 +166,4 @@ There are some common pitfalls you may encounter when using coroutines. [1]: https://en.cppreference.com/w/cpp/language/coroutines -# 17 [Redis](ENG-17-Redis) +# 17 [Redis](/ENG/ENG-17-Redis) diff --git a/ENG/ENG-18-Redis.md b/ENG/ENG-18-Redis.md index e18cb57..a9b54f2 100644 --- a/ENG/ENG-18-Redis.md +++ b/ENG/ENG-18-Redis.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-17-Redis) +##### Other languages: [简体中文](/CHN/CHN-17-Redis) Drogon supports Redis, a very fast, in-memory data store. Which could be used as a database cache or a message broker. Like everything in Drogon, Redis connections are asynchronous. Which ensures Drogon running with very high concurrency even under heavy load. @@ -102,7 +102,7 @@ redisClient->newTransactionAsync([](const RedisTransactionPtr &transPtr) { ### Coroutines -Redis clients support coroutines. One should use the GCC 11 or a newer compiler and use `cmake -DCMAKE_CXX_FLAGS="-std=c++20"` to enable it. See the (coroutine)[ENG-16-Coroutines] section for more information. +Redis clients support coroutines. One should use the GCC 11 or a newer compiler and use `cmake -DCMAKE_CXX_FLAGS="-std=c++20"` to enable it. See the (coroutine)[/ENG/ENG-16-Coroutines] section for more information. ```c++ try @@ -118,4 +118,4 @@ catch(const std::exception& e) } ``` -# 18 [Testing Framework](ENG-18-Testing-Framework) +# 18 [Testing Framework](/ENG/ENG-18-Testing-Framework) diff --git a/ENG/ENG-19-Testing-Framework.md b/ENG/ENG-19-Testing-Framework.md index 8127818..ab7212d 100644 --- a/ENG/ENG-19-Testing-Framework.md +++ b/ENG/ENG-19-Testing-Framework.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-18-测试框架) +##### Other languages: [简体中文](/CHN/CHN-18-测试框架) DrogonTest is a minimal testing framework built into drogon to enable easy asynchronous testing as well as synchronous ones. It is used for Drogon's own unittests and integration tests. But could also be used for testing applications built with Drogon. The syntax of DrogonTest is inspired by both [GTest](https://github.com/google/googletest) and [Catch2](https://github.com/catchorg/Catch2). diff --git a/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md b/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md index 62eefd3..f89e05d 100644 --- a/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md +++ b/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-FAQ-1-线程模型.md) +##### Other languages: [简体中文](/CHN/CHN-FAQ-1-线程模型.md) # Understanding Drogon's threading model diff --git a/ENG/ENG-FAQ.md b/ENG/ENG-FAQ.md index 1471d6c..e5ee413 100644 --- a/ENG/ENG-FAQ.md +++ b/ENG/ENG-FAQ.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](CHN-FAQ) +##### Other languages: [简体中文](/CHN/CHN-FAQ) # FAQ @@ -6,4 +6,4 @@ This is a list of commonly asked questions and the answers, with some extended e ## What's drogon's threading model and best practices? -Drogon runs on a thread pool where the HTTP server threads as well as DB threads are created when `app().run()` is called. It is a sequential task based system. Thus it is recommended to always use the asynchronous APIs or coroutines when possible. See [Understanding drogon's threading model](ENG-FAQ-1-Understanding-drogon-threading-model) for detail. +Drogon runs on a thread pool where the HTTP server threads as well as DB threads are created when `app().run()` is called. It is a sequential task based system. Thus it is recommended to always use the asynchronous APIs or coroutines when possible. See [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) for detail. diff --git a/ENG/Home.md b/ENG/Home.md index c8c054e..f0aee89 100644 --- a/ENG/Home.md +++ b/ENG/Home.md @@ -1,80 +1,80 @@ [English](Home) | [简体中文](Home.zh-CN) -### [Welcome to the drogon wiki!](ENG-01-Overview) -* [Overview](ENG-01-Overview) -* [Install drogon](ENG-02-Installation) - * [System Requirements](ENG-02-Installation#System-Requirements) - * [Library Dependencies](ENG-02-Installation#Library-Dependencies) - * [System Preparation Examples](ENG-02-Installation#System-Preparation-Examples) - * [Ubuntu](ENG-02-Installation#Ubuntu-1804) - * [CentOS](ENG-02-Installation#CentOS-75) - * [MacOS](ENG-02-Installation#MacOS-122) - * [Windows](ENG-02-Installation#Windows) - * [Database Environment](ENG-02-Installation#Database-Environment) - * [PostgreSQL](ENG-02-Installation#PostgreSQL) - * [MySQL](ENG-02-Installation#MySQL) - * [SQLite3](ENG-02-Installation#SQLite3) - * [Redis](ENG-02-Installation#Redis) - * [Drogon Installation](ENG-02-Installation#Drogon-Installation) - * [Install by source in Linux](ENG-02-Installation#Install-by-source-in-Linux) - * [Install by source in Windows](ENG-02-Installation#Install-by-source-in-Windows) - * [Install by vcpkg in Windows](ENG-02-Installation#Install-by-vcpkg-in-Windows) - * [Use Docker Image](ENG-02-Installation#Use-Docker-Image) - * [Use Nix Package](ENG-02-Installation#Use-Nix-Package) - * [Use CPM.cmake](CHN-02-安装#Use-CPM.cmake) - * [Include drogon source code locally](ENG-02-Installation#Include-drogon-source-code-locally) -* [Quick Start](ENG-03-Quick-Start) - * [Static Site](ENG-03-Quick-Start#Static-Site) - * [Dynamic Site](ENG-03-Quick-Start#Dynamic-Site) -* [Controller](ENG-04-0-Controller-Introduction) - * [HttpSimpleController](ENG-04-1-Controller-HttpSimpleController) - * [HttpController](ENG-04-2-Controller-HttpController) - * [Path Mapping](ENG-04-2-Controller-HttpController#Path-Mapping) - * [Parameter Mapping](ENG-04-2-Controller-HttpController#Parameter-Mapping) - * [Multiple Path Mapping](ENG-04-2-Controller-HttpController#Multiple-Path-Mapping) - * [Regular Expressions Mapping](ENG-04-2-Controller-HttpController#Regular-Expressions-Mapping) - * [WebSocketController](ENG-04-3-Controller-WebSocketController) - * [Path Mapping](ENG-04-3-Controller-WebSocketController#Path-Mapping) - * [Interface](ENG-04-3-Controller-WebSocketController#Interface) -* [Middleware and Filter](ENG-05-Middleware-and-Filter) - * [Build-in Middleware/Filter](ENG-05-Middleware-and-Filter#Built-in-Middleware/Filter) - * [Custom Middleware/Filter](ENG-05-Middleware-and-Filter#Custom-Middleware/Filter) -* [View](ENG-06-View) - * [Drogon's CSP](ENG-06-View#Drogon's-CSP) - * [Automated processing of csp files](ENG-06-View#Automated-processing-of-csp-files) - * [Dynamic compilation and loading of views](ENG-06-View#Dynamic-compilation-and-loading-of-views) -* [Session](ENG-07-Session) -* [Database](ENG-08-0-Database-General) - * [DbClient](ENG-08-1-Database-DbClient) - * [Execution Interface](ENG-08-1-Database-DbClient#Execution-Interface) - * [execSqlAsync](ENG-08-1-Database-DbClient#execSqlAsync) - * [execSqlAsyncFuture](ENG-08-1-Database-DbClient#execSqlAsyncFuture) - * [execSqlSync](ENG-08-1-Database-DbClient#execSqlSync) - * [operator<<](ENG-08-1-Database-DbClient#operator<<) - * [Transaction](ENG-08-2-Database-Transaction) - * [ORM](ENG-08-3-Database-ORM) - * [Model Class Interface](ENG-08-3-Database-ORM#Model-Class-Interface) - * [Mapper Class Template](ENG-08-3-Database-ORM#Mapper-Class-Template) - * [Criteria](CHN-08-3-Database-ORM#Criteria) - * [Mapper's Chain Interface](CHN-08-3-Database-ORM#Mapper's-Chain-Interface) - * [Convert](CHN-08-3-Database-ORM#Convert) - * [Relationships](CHN-08-3-Database-ORM#Relationships) - * [has one](CHN-08-3-Database-ORM#has-one) - * [has many](CHN-08-3-Database-ORM#has-many) - * [many to many](CHN-08-3-Database-ORM#many-to-many) - * [FastDbClient](ENG-08-4-Database-FastDbClient) - * [Automatic batch mode](ENG-08-5-Database-auto_batch) -* [Plugins](ENG-09-Plugins) -* [Configuration File](ENG-10-Configuration-File) -* [drogon_ctl Command](ENG-11-drogon_ctl-Command) -* [AOP](ENG-12-AOP-Aspect-Oriented-Programming) -* [Benchmarks](ENG-13-Benchmarks) -* [Coz profiling](ENG-14-Coz) -* [Brotli info](ENG-15-Brotli) -* [Coroutines](ENG-16-Coroutines) -* [Redis](ENG-17-Redis) -* [Testing Framework](ENG-18-Testing-Framework) -* [FAQ](ENG-FAQ) - * [Understanding drogon's threading model](ENG-FAQ-1-Understanding-drogon-threading-model) +### [Welcome to the drogon wiki!](/ENG/ENG-01-Overview) +* [Overview](/ENG/ENG-01-Overview) +* [Install drogon](/ENG/ENG-02-Installation) + * [System Requirements](/ENG/ENG-02-Installation#System-Requirements) + * [Library Dependencies](/ENG/ENG-02-Installation#Library-Dependencies) + * [System Preparation Examples](/ENG/ENG-02-Installation#System-Preparation-Examples) + * [Ubuntu](/ENG/ENG-02-Installation#Ubuntu-1804) + * [CentOS](/ENG/ENG-02-Installation#CentOS-75) + * [MacOS](/ENG/ENG-02-Installation#MacOS-122) + * [Windows](/ENG/ENG-02-Installation#Windows) + * [Database Environment](/ENG/ENG-02-Installation#Database-Environment) + * [PostgreSQL](/ENG/ENG-02-Installation#PostgreSQL) + * [MySQL](/ENG/ENG-02-Installation#MySQL) + * [SQLite3](/ENG/ENG-02-Installation#SQLite3) + * [Redis](/ENG/ENG-02-Installation#Redis) + * [Drogon Installation](/ENG/ENG-02-Installation#Drogon-Installation) + * [Install by source in Linux](/ENG/ENG-02-Installation#Install-by-source-in-Linux) + * [Install by source in Windows](/ENG/ENG-02-Installation#Install-by-source-in-Windows) + * [Install by vcpkg in Windows](/ENG/ENG-02-Installation#Install-by-vcpkg-in-Windows) + * [Use Docker Image](/ENG/ENG-02-Installation#Use-Docker-Image) + * [Use Nix Package](/ENG/ENG-02-Installation#Use-Nix-Package) + * [Use CPM.cmake](/CHN/CHN-02-安装#Use-CPM.cmake) + * [Include drogon source code locally](/ENG/ENG-02-Installation#Include-drogon-source-code-locally) +* [Quick Start](/ENG/ENG-03-Quick-Start) + * [Static Site](/ENG/ENG-03-Quick-Start#Static-Site) + * [Dynamic Site](/ENG/ENG-03-Quick-Start#Dynamic-Site) +* [Controller](/ENG/ENG-04-0-Controller-Introduction) + * [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) + * [HttpController](/ENG/ENG-04-2-Controller-HttpController) + * [Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Path-Mapping) + * [Parameter Mapping](/ENG/ENG-04-2-Controller-HttpController#Parameter-Mapping) + * [Multiple Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Multiple-Path-Mapping) + * [Regular Expressions Mapping](/ENG/ENG-04-2-Controller-HttpController#Regular-Expressions-Mapping) + * [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) + * [Path Mapping](/ENG/ENG-04-3-Controller-WebSocketController#Path-Mapping) + * [Interface](/ENG/ENG-04-3-Controller-WebSocketController#Interface) +* [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) + * [Build-in Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Built-in-Middleware/Filter) + * [Custom Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Custom-Middleware/Filter) +* [View](/ENG/ENG-06-View) + * [Drogon's CSP](/ENG/ENG-06-View#Drogon's-CSP) + * [Automated processing of csp files](/ENG/ENG-06-View#Automated-processing-of-csp-files) + * [Dynamic compilation and loading of views](/ENG/ENG-06-View#Dynamic-compilation-and-loading-of-views) +* [Session](/ENG/ENG-07-Session) +* [Database](/ENG/ENG-08-0-Database-General) + * [DbClient](/ENG/ENG-08-1-Database-DbClient) + * [Execution Interface](/ENG/ENG-08-1-Database-DbClient#Execution-Interface) + * [execSqlAsync](/ENG/ENG-08-1-Database-DbClient#execSqlAsync) + * [execSqlAsyncFuture](/ENG/ENG-08-1-Database-DbClient#execSqlAsyncFuture) + * [execSqlSync](/ENG/ENG-08-1-Database-DbClient#execSqlSync) + * [operator<<](/ENG/ENG-08-1-Database-DbClient#operator<<) + * [Transaction](/ENG/ENG-08-2-Database-Transaction) + * [ORM](/ENG/ENG-08-3-Database-ORM) + * [Model Class Interface](/ENG/ENG-08-3-Database-ORM#Model-Class-Interface) + * [Mapper Class Template](/ENG/ENG-08-3-Database-ORM#Mapper-Class-Template) + * [Criteria](/CHN/CHN-08-3-Database-ORM#Criteria) + * [Mapper's Chain Interface](/CHN/CHN-08-3-Database-ORM#Mapper's-Chain-Interface) + * [Convert](/CHN/CHN-08-3-Database-ORM#Convert) + * [Relationships](/CHN/CHN-08-3-Database-ORM#Relationships) + * [has one](/CHN/CHN-08-3-Database-ORM#has-one) + * [has many](/CHN/CHN-08-3-Database-ORM#has-many) + * [many to many](/CHN/CHN-08-3-Database-ORM#many-to-many) + * [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) + * [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) +* [Plugins](/ENG/ENG-09-Plugins) +* [Configuration File](/ENG/ENG-10-Configuration-File) +* [drogon_ctl Command](/ENG/ENG-11-drogon_ctl-Command) +* [AOP](/ENG/ENG-12-AOP-Aspect-Oriented-Programming) +* [Benchmarks](/ENG/ENG-13-Benchmarks) +* [Coz profiling](/ENG/ENG-14-Coz) +* [Brotli info](/ENG/ENG-15-Brotli) +* [Coroutines](/ENG/ENG-16-Coroutines) +* [Redis](/ENG/ENG-17-Redis) +* [Testing Framework](/ENG/ENG-18-Testing-Framework) +* [FAQ](/ENG/ENG-FAQ) + * [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) ### To contribute to the wiki, please visit the [drogon-docs](https://github.com/drogonframework/drogon-docs) repository. From 6f85c862c574a1f3d2c1a701fd447f74300f4c48 Mon Sep 17 00:00:00 2001 From: Chuck <32836622+chuckn408@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:49:35 -0700 Subject: [PATCH 3/7] Touch-up localization links --- "CHN/CHN-01-\346\246\202\350\277\260.md" | 4 +- "CHN/CHN-02-\345\256\211\350\243\205.md" | 4 +- ...53\351\200\237\345\274\200\345\247\213.md" | 8 +- ...6\345\231\250-\347\256\200\344\273\213.md" | 4 +- ...0\266\345\231\250-HttpSimpleController.md" | 6 +- ...345\210\266\345\231\250-HttpController.md" | 4 +- ...10\266\345\231\250-WebSocketController.md" | 6 +- ...14\350\277\207\346\273\244\345\231\250.md" | 8 +- "CHN/CHN-06-\350\247\206\345\233\276.md" | 4 +- "CHN/CHN-07-\344\274\232\350\257\235.md" | 4 +- ...6\345\272\223-\346\246\202\350\277\260.md" | 12 +- ...5\260\346\215\256\345\272\223-DbClient.md" | 6 +- ...6\345\272\223-\344\272\213\345\212\241.md" | 4 +- ...46\225\260\346\215\256\345\272\223-ORM.md" | 8 +- ...0\346\215\256\345\272\223-FastDbClient.md" | 6 +- ...50\346\211\271\345\244\204\347\220\206.md" | 4 +- "CHN/CHN-09-\346\217\222\344\273\266.md" | 4 +- ...15\347\275\256\346\226\207\344\273\266.md" | 12 +- ...-11-drogon_ctl\345\221\275\344\273\244.md" | 10 +- ...07\351\235\242\347\274\226\347\250\213.md" | 8 +- ...47\350\203\275\346\265\213\350\257\225.md" | 4 +- "CHN/CHN-14-Coz\345\210\206\346\236\220.md" | 4 +- .../CHN-15-Brotli\345\216\213\347\274\251.md" | 4 +- "CHN/CHN-16-\345\215\217\347\250\213.md" | 4 +- CHN/CHN-17-Redis.md | 6 +- ...13\350\257\225\346\241\206\346\236\266.md" | 2 +- ...77\347\250\213\346\250\241\345\236\213.md" | 2 +- CHN/CHN-FAQ.md | 4 +- CHN/Home.zh-CN.md | 148 ++++----- ENG/ENG-01-Overview.md | 4 +- ENG/ENG-02-Installation.md | 4 +- ENG/ENG-03-Quick-Start.md | 8 +- ENG/ENG-04-0-Controller-Introduction.md | 6 +- ...NG-04-1-Controller-HttpSimpleController.md | 6 +- ENG/ENG-04-2-Controller-HttpController.md | 4 +- ...ENG-04-3-Controller-WebSocketController.md | 6 +- ENG/ENG-05-Middleware-and-Filter.md | 8 +- ENG/ENG-06-View.md | 4 +- ENG/ENG-07-Session.md | 4 +- ENG/ENG-08-0-Database-General.md | 12 +- ENG/ENG-08-1-Database-DbClient.md | 6 +- ENG/ENG-08-2-Database-Transaction.md | 4 +- ENG/ENG-08-3-Database-ORM.md | 8 +- ENG/ENG-08-4-Database-FastDbClient.md | 6 +- ENG/ENG-08-5-Database-auto_batch.md | 4 +- ENG/ENG-09-0-References-request.md | 6 +- ENG/ENG-09-1-File-Handler.md | 2 +- ENG/ENG-10-Plugins.md | 4 +- ENG/ENG-11-Configuration-File.md | 12 +- ENG/ENG-12-drogon_ctl-Command.md | 10 +- ENG/ENG-13-AOP-Aspect-Oriented-Programming.md | 4 +- ENG/ENG-14-Benchmarks.md | 4 +- ENG/ENG-15-Coz.md | 4 +- ENG/ENG-16-Brotli.md | 4 +- ENG/ENG-17-Coroutines.md | 4 +- ENG/ENG-18-Redis.md | 6 +- ENG/ENG-19-Testing-Framework.md | 2 +- ...-1-Understanding-drogon-threading-model.md | 2 +- ENG/ENG-FAQ.md | 4 +- ENG/Home.md | 152 ++++----- _Sidebar.md | 302 +++++++++--------- index.html | 2 +- 62 files changed, 461 insertions(+), 461 deletions(-) diff --git "a/CHN/CHN-01-\346\246\202\350\277\260.md" "b/CHN/CHN-01-\346\246\202\350\277\260.md" index 3b6b543..870232c 100644 --- "a/CHN/CHN-01-\346\246\202\350\277\260.md" +++ "b/CHN/CHN-01-\346\246\202\350\277\260.md" @@ -1,4 +1,4 @@ -[English](ENG-01-Overview) | [简体中文](CHN-01-概述) +[English](/ENG/ENG-01-Overview) | [简体中文](/CHN/CHN-01-概述) **Drogon**是一个基于C++17/20的Http应用框架,使用Drogon可以方便的使用C++构建各种类型的Web应用服务端程序。 @@ -29,4 +29,4 @@ Drogon的主要应用平台是Linux,也支持Mac OS、FreeBSD和Windows。 * 支持插件,可通过配置文件在加载期动态拆装; * 支持内建插入点的AOP -# 02 [安装drogon](CHN-02-安装) +# 02 [安装drogon](/CHN/CHN-02-安装) diff --git "a/CHN/CHN-02-\345\256\211\350\243\205.md" "b/CHN/CHN-02-\345\256\211\350\243\205.md" index 66416d6..ba04788 100644 --- "a/CHN/CHN-02-\345\256\211\350\243\205.md" +++ "b/CHN/CHN-02-\345\256\211\350\243\205.md" @@ -1,4 +1,4 @@ -[English](ENG-02-Installation) | [简体中文](CHN-02-安装) +[English](/ENG/ENG-02-Installation) | [简体中文](/CHN/CHN-02-安装) 本节以Ubuntu 18.04, CentOS 7.5, MacOS 12.2为例,简介安装过程,其它系统,大同小异; @@ -472,4 +472,4 @@ pip install conan target_link_libraries(${PROJECT_NAME} PRIVATE drogon) ``` -# 03 [快速开始](CHN-03-快速开始) +# 03 [快速开始](/CHN/CHN-03-快速开始) diff --git "a/CHN/CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" "b/CHN/CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" index 83e8680..c201e4e 100644 --- "a/CHN/CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" +++ "b/CHN/CHN-03-\345\277\253\351\200\237\345\274\200\345\247\213.md" @@ -1,4 +1,4 @@ -[English](ENG-03-Quick-Start) | [简体中文](CHN-03-快速开始) +[English](/ENG/ENG-03-Quick-Start) | [简体中文](/CHN/CHN-03-快速开始) ## 静态网站 @@ -22,7 +22,7 @@ drogon_ctl create project your_project_name └── views 存放视图csp文件的目录 ``` -文件夹的名字就反应了它的用途,用户可以把各类文件(如控制器、过滤器、视图等等)分别放入对应的文件夹,方便项目管理,请读者自行实验。关于`drogon_ctl`的详细使用,可参见[drogon_ctl](CHN-11-drogon_ctl命令) +文件夹的名字就反应了它的用途,用户可以把各类文件(如控制器、过滤器、视图等等)分别放入对应的文件夹,方便项目管理,请读者自行实验。关于`drogon_ctl`的详细使用,可参见[drogon_ctl](/CHN/CHN-11-drogon_ctl命令) 让我们看一下main.cc文件,内容如下: @@ -55,7 +55,7 @@ make echo '

Hello Drogon!

' >>index.html ``` -Http根目录默认值是`"./"`, 也就是webapp程序运行的当前路径, Http根目录也可在config.json配置文件中进行更改,可参见[配置文件](CHN-10-配置文件), 然后在地址栏输入`http://localhost`或`http://localhost/index.html`(或者你的webapp所在服务器的ip)可以访问到这个页面: +Http根目录默认值是`"./"`, 也就是webapp程序运行的当前路径, Http根目录也可在config.json配置文件中进行更改,可参见[配置文件](/CHN/CHN-10-配置文件), 然后在地址栏输入`http://localhost`或`http://localhost/index.html`(或者你的webapp所在服务器的ip)可以访问到这个页面: ![Hello Drogon!](images/hellodrogon.png) 如果服务器找不到浏览器访问的页面,将返回404页面: @@ -190,4 +190,4 @@ make > **注意: Drogon没有限制控制器(controller)源文件的位置,也可以放在工程目录下,甚至可以在`CMakeLists.txt`中指定到新的目录中,为了方便管理,建议将控制器源文件放在controllers目录。** -# 04.0 [控制器简介](CHN-04-0-控制器-简介) +# 04.0 [控制器简介](/CHN/CHN-04-0-控制器-简介) diff --git "a/CHN/CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" "b/CHN/CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" index a197e22..4b853ca 100644 --- "a/CHN/CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" +++ "b/CHN/CHN-04-0-\346\216\247\345\210\266\345\231\250-\347\256\200\344\273\213.md" @@ -1,4 +1,4 @@ -[English](ENG-04-0-Controller-Introduction) | [简体中文](CHN-04-控制器-简介) +[English](/ENG/ENG-04-0-Controller-Introduction) | [简体中文](/CHN/CHN-04-控制器-简介) 控制器(controller)在web应用开发中处于相当重要的地位,它处理浏览器发来的请求,然后生成响应发送给浏览器;drogon框架已经帮我们处理好网络传输、Http协议的解析等等细节,我们只需要关注控制器的逻辑即可;每一个控制器对象可以有一个或者多个处理函数(一般称为handler),函数的接口,一般定义成如下形式: @@ -33,4 +33,4 @@ public: 注册到drogon框架的控制器最多只会有一个实例,在整个应用运行期间都不会销毁,所以,用户可以在控制器类中声明和使用成员变量。注意,控制器的handler被调用时,是在多线程环境下的(当框架的IO线程数配置成大于1的值时),如果需要访问非临时变量,请做好并发保护工作。 -# 04.1 [HttpSimpleController](CHN-04-1-控制器-HttpSimpleController) +# 04.1 [HttpSimpleController](/CHN/CHN-04-1-控制器-HttpSimpleController) diff --git "a/CHN/CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" "b/CHN/CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" index c1ce097..62baaf9 100644 --- "a/CHN/CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" +++ "b/CHN/CHN-04-1-\346\216\247\345\210\266\345\231\250-HttpSimpleController.md" @@ -1,4 +1,4 @@ -[English](ENG-04-1-Controller-HttpSimpleController) | [简体中文](CHN-04-1-控制器-HttpSimpleController) +[English](/ENG/ENG-04-1-Controller-HttpSimpleController) | [简体中文](/CHN/CHN-04-1-控制器-HttpSimpleController) 可以由`drogon_ctl`命令行工具快速生成基于`HttpSimpleController`的自定义类的源文件,命令格式如下: @@ -47,7 +47,7 @@ void TestCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, 从URL路径到处理函数的路由(或称映射)由宏完成,可以用`PATH_ADD`宏添加多重路径映射,所有`PATH_ADD`语句应夹在`PATH_LIST_BEGIN`和`PATH_LIST_END`宏语句之间。 -第一个参数是映射的路径,路径后面的参数是对这个路径的约束,目前支持两种约束,一种是`HttpMethod`类型,表示该路径允许使用的Http方法,可以配置零个或多个,一种是`HttpFilter`类的名字,这种对象执行特定的过滤操作,也可以配置0个或多个,两种类型没有顺序要求,框架会处理好类型的匹配。关于Filter,请参阅[中间件和过滤器](CHN-05-中间件和过滤器)。 +第一个参数是映射的路径,路径后面的参数是对这个路径的约束,目前支持两种约束,一种是`HttpMethod`类型,表示该路径允许使用的Http方法,可以配置零个或多个,一种是`HttpFilter`类的名字,这种对象执行特定的过滤操作,也可以配置0个或多个,两种类型没有顺序要求,框架会处理好类型的匹配。关于Filter,请参阅[中间件和过滤器](/CHN/CHN-05-中间件和过滤器)。 用户可以把同一个Simple Controller注册到多个路径上,也可以在同一个路径上注册多个Simple Controller通过 HTTP method 区分)。 @@ -64,4 +64,4 @@ void TestCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, > **上述路径到处理函数的映射是在编译期完成的,事实上,drogon框架也提供了运行期完成映射的接口,运行期映射可以让用户通过配置文件或其它用户接口完成映射或修改映射关系而无需重新编译这个程序(出于性能的考虑,禁止在运行app().run()之后再注册任何映射)。** -# 04.2 [HttpController](CHN-04-2-控制器-HttpController) +# 04.2 [HttpController](/CHN/CHN-04-2-控制器-HttpController) diff --git "a/CHN/CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" "b/CHN/CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" index d585dfb..0b8b0b0 100644 --- "a/CHN/CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" +++ "b/CHN/CHN-04-2-\346\216\247\345\210\266\345\231\250-HttpController.md" @@ -1,4 +1,4 @@ -[English](ENG-04-2-Controller-HttpController) | [简体中文](CHN-04-2-控制器-HttpController) +[English](/ENG/ENG-04-2-Controller-HttpController) | [简体中文](/CHN/CHN-04-2-控制器-HttpController) ### 生成 @@ -280,4 +280,4 @@ void User::getInfo(const HttpRequestPtr &req, > **需要注意的是,使用正则表达式要注意匹配冲突(多个不同的handler都匹配),当冲突发生在同一个controller内部时,drogon只会执行第一个handler(先注册进框架的那个handler),当冲突发生在不同controller之间时,执行哪个handler是不确定的,因此用户需要避免这种冲突发生。** -# 04.3 [WebSocketController](CHN-04-3-控制器-WebSocketController) +# 04.3 [WebSocketController](/CHN/CHN-04-3-控制器-WebSocketController) diff --git "a/CHN/CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" "b/CHN/CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" index c6c8ccd..fb29eef 100644 --- "a/CHN/CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" +++ "b/CHN/CHN-04-3-\346\216\247\345\210\266\345\231\250-WebSocketController.md" @@ -1,4 +1,4 @@ -[English](ENG-04-3-Controller-WebSocketController) | [简体中文](CHN-04-3-控制器-WebSocketController) +[English](/ENG/ENG-04-3-Controller-WebSocketController) | [简体中文](/CHN/CHN-04-3-控制器-WebSocketController) 顾名思义,`WebSocketController`用于处理websocket逻辑。websocket是基于HTTP的一种长连接方案,在websocket建立之初,有一次HTTP格式的请求和应答交换,建立完成后,所有的消息在websocket上传输,消息由固定的格式包装,但消息的内容和收发次序没有任何要求,完全由用户定义。 @@ -99,7 +99,7 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr } ``` - 首先,在这个例子中,通过`WS_PATH_ADD`宏把这个控制器注册到了`/echo`路径上,`WS_PATH_ADD`宏的用法跟之前介绍的其他控制器的宏类似,也可以注册路径并且附带若干[中间件和过滤器](CHN-05-中间件和过滤器)。由于websocket在框架中单独处理,所以它可以和前两种控制器的路径重复而不会相互影响。 + 首先,在这个例子中,通过`WS_PATH_ADD`宏把这个控制器注册到了`/echo`路径上,`WS_PATH_ADD`宏的用法跟之前介绍的其他控制器的宏类似,也可以注册路径并且附带若干[中间件和过滤器](/CHN/CHN-05-中间件和过滤器)。由于websocket在框架中单独处理,所以它可以和前两种控制器的路径重复而不会相互影响。 其次,本例中三个虚函数的实现,只有handleNewMessage有实质内容,只是简单的把收到的消息通过send接口发回客户端。把这个控制器编译进框架,就可以看到效果,请各位自己试验吧。 @@ -148,4 +148,4 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr any *getMutableContext(); ``` -# 05 [中间件和过滤器](CHN-05-中间件和过滤器) +# 05 [中间件和过滤器](/CHN/CHN-05-中间件和过滤器) diff --git "a/CHN/CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" "b/CHN/CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" index 5b295e3..ee613e0 100644 --- "a/CHN/CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" +++ "b/CHN/CHN-05-\344\270\255\351\227\264\344\273\266\345\222\214\350\277\207\346\273\244\345\231\250.md" @@ -1,6 +1,6 @@ -[English](ENG-05-Middleware-and-Filter) | [简体中文](CHN-05-中间件和过滤器) +[English](/ENG/ENG-05-Middleware-and-Filter) | [简体中文](/CHN/CHN-05-中间件和过滤器) -中间件(middleware)和过滤器(filter)可以帮助用户提高编程效率,在HttpController的[例子](CHN-04-2-控制器-HttpController)中,getInfo方法在返回用户信息之前应该先校验用户是否登录,我们把这个逻辑写在getInfo方法里当然是可以的,但是,很显然,校验用户登录属于通用逻辑,很多接口都将用到,应该把它单独提取出来,再配置到调用handler之前,这就是filter的作用。 +中间件(middleware)和过滤器(filter)可以帮助用户提高编程效率,在HttpController的[例子](/CHN/CHN-04-2-控制器-HttpController)中,getInfo方法在返回用户信息之前应该先校验用户是否登录,我们把这个逻辑写在getInfo方法里当然是可以的,但是,很显然,校验用户登录属于通用逻辑,很多接口都将用到,应该把它单独提取出来,再配置到调用handler之前,这就是filter的作用。 drogon的中间件采用了洋葱圈模型, 框架做完URL路径匹配后,会依次调用注册到该路径上的中间件,在每个中间件中,用户可以选择拦截或放行请求,并添加前置、后置处理逻辑。 如果有一个中间件拦截了请求,该请求将不会继续深入洋葱圈内层,对应的handler也不会被调用,但是仍然会通过外层中间件的后置处理逻辑。 @@ -69,7 +69,7 @@ drogon内置了如下常用过滤器: }; ``` - 你可以通过 `drogon_ctl` 命令创建过滤器, 见 [drogon_ctl](CHN-11-drogon_ctl命令#过滤器创建). + 你可以通过 `drogon_ctl` 命令创建过滤器, 见 [drogon_ctl](/CHN/CHN-11-drogon_ctl命令#过滤器创建). 我们需要重载父类的doFilter虚函数实现过滤器逻辑; @@ -98,4 +98,4 @@ drogon内置了如下常用过滤器: > **注意: 如果中间件/过滤器定义在命名空间里,注册时必须把命名空间写全** -# 06 [视图](CHN-06-视图) +# 06 [视图](/CHN/CHN-06-视图) diff --git "a/CHN/CHN-06-\350\247\206\345\233\276.md" "b/CHN/CHN-06-\350\247\206\345\233\276.md" index f2d330f..2f020a1 100644 --- "a/CHN/CHN-06-\350\247\206\345\233\276.md" +++ "b/CHN/CHN-06-\350\247\206\345\233\276.md" @@ -1,4 +1,4 @@ -[English](ENG-06-View) | [简体中文](CHN-06-视图) +[English](/ENG/ENG-06-View) | [简体中文](/CHN/CHN-06-视图) ### 视图介绍 @@ -155,4 +155,4 @@ void enableDynamicViewsLoading(const std::vector &libPaths); > **注意: 如果加载时遇到`symbol not found`错误,请使用`cmake .. -DCMAKE_ENABLE_EXPORTS=on`或取消CMakeLists.txt最后一行对`set_property(TARGET ${PROJECT_NAME} PROPERTY ENABLE_EXPORTS ON)`的注释,并重新编译你的工程** -# 07 [会话](CHN-07-会话) +# 07 [会话](/CHN/CHN-07-会话) diff --git "a/CHN/CHN-07-\344\274\232\350\257\235.md" "b/CHN/CHN-07-\344\274\232\350\257\235.md" index 36c9316..8ad0022 100644 --- "a/CHN/CHN-07-\344\274\232\350\257\235.md" +++ "b/CHN/CHN-07-\344\274\232\350\257\235.md" @@ -1,4 +1,4 @@ -[English](ENG-07-Session) | [简体中文](CHN-07-会话) +[English](/ENG/ENG-07-Session) | [简体中文](/CHN/CHN-07-会话) `会话(Session)`是web应用的重要概念,用于在服务端保存客户端的状态,一般和浏览器的`cookie`配合,drogon提供了对会话的支持。drogon默认**关闭**会话选择,你也可以通过如下接口关闭或打开: @@ -97,4 +97,4 @@ drogon::HttpAppFramework::instance().enableSession(1200); 用cmake重新编译整个工程,运行目标程序webapp,就可以通过浏览器看到效果了。 -# [数据库](CHN-08-0-数据库-概述) +# [数据库](/CHN/CHN-08-0-数据库-概述) diff --git "a/CHN/CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" "b/CHN/CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" index 8f52110..e9d75cc 100644 --- "a/CHN/CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" +++ "b/CHN/CHN-08-0-\346\225\260\346\215\256\345\272\223-\346\246\202\350\277\260.md" @@ -1,8 +1,8 @@ -[English](ENG-08-0-Database-General) | [简体中文](CHN-08-0-数据库-概述) +[English](/ENG/ENG-08-0-Database-General) | [简体中文](/CHN/CHN-08-0-数据库-概述) ### 概述 -**Drogon**内置了数据库读写引擎,对数据库连接的操作基于non-blocking I/O技术实现,因此,从底层到上层接口,都是高效率的非阻塞异步方式,保证了Drogon对高并发性能的追求。目前,Drogon支持PostgreSQL和MySQL数据库,如果要使用数据库,开发系统必须先安装相应数据库的开发环境,Drogon会自动探测这些库的头文件和库文件,编译相应的部分。数据库开发环境的准备,参见[安装数据库环境](CHN-02-安装#数据库环境)。 +**Drogon**内置了数据库读写引擎,对数据库连接的操作基于non-blocking I/O技术实现,因此,从底层到上层接口,都是高效率的非阻塞异步方式,保证了Drogon对高并发性能的追求。目前,Drogon支持PostgreSQL和MySQL数据库,如果要使用数据库,开发系统必须先安装相应数据库的开发环境,Drogon会自动探测这些库的头文件和库文件,编译相应的部分。数据库开发环境的准备,参见[安装数据库环境](/CHN/CHN-02-安装#数据库环境)。 **Drogon**为了支持轻量级应用,也支持sqlite3数据库,通过线程池实现异步接口,与前述数据库的接口是统一的。 @@ -14,14 +14,14 @@ Drogon的数据库基本操作对象是`DbClient`(这是一个抽象类,用户 通常,一个异步接口调用时,DbClient会在它管理的空闲连接中随机选取一个,执行相关的查询操作,待有结果返回时,`DbClient`会处理数据,通过回调函数对象返回给调用方;如果调用时没有空闲连接,执行内容会被缓存,一旦有连接执行完自己的sql请求,就会从缓存中依次取出待执行的命令去执行。 -`DbClient`的详细内容,见[DbClient](CHN-08-1-数据库-DbClient)。 +`DbClient`的详细内容,见[DbClient](/CHN/CHN-08-1-数据库-DbClient)。 ### 事务 -由`DbClient`可以产生事务对象,用以支持事务操作,事务对象除了多出一个`rollback()`接口,其余基本和`DbClient`一致,事务对象的类是`Transaction`,关于事务的详细内容,参见[事务](CHN-08-2-数据库-事务)。 +由`DbClient`可以产生事务对象,用以支持事务操作,事务对象除了多出一个`rollback()`接口,其余基本和`DbClient`一致,事务对象的类是`Transaction`,关于事务的详细内容,参见[事务](/CHN/CHN-08-2-数据库-事务)。 ### ORM -Drogon也提供了对**ORM**的支持,用户可以通过drogon_ctl读取数据库中的表,并生成对应的model对象类源码,然后,通过`Mapper`类模板完成这些对象的数据库操作,为标准的数据操作提供了简单便捷的接口,使用户可以不用自己写sql语句就可以完成对表的增删改查。关于**ORM**,请参阅[ORM](CHN-08-3-数据库-ORM)。 +Drogon也提供了对**ORM**的支持,用户可以通过drogon_ctl读取数据库中的表,并生成对应的model对象类源码,然后,通过`Mapper`类模板完成这些对象的数据库操作,为标准的数据操作提供了简单便捷的接口,使用户可以不用自己写sql语句就可以完成对表的增删改查。关于**ORM**,请参阅[ORM](/CHN/CHN-08-3-数据库-ORM)。 -# 08.1 [DbClient](CHN-08-1-数据库-DbClient) +# 08.1 [DbClient](/CHN/CHN-08-1-数据库-DbClient) diff --git "a/CHN/CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" "b/CHN/CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" index ab28c1f..c81cad8 100644 --- "a/CHN/CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" +++ "b/CHN/CHN-08-1-\346\225\260\346\215\256\345\272\223-DbClient.md" @@ -1,4 +1,4 @@ -[English](ENG-08-1-Database-DbClient) | [简体中文](CHN-08-1-数据库-DbClient) +[English](/ENG/ENG-08-1-Database-DbClient) | [简体中文](/CHN/CHN-08-1-数据库-DbClient) ### 构建DbClient @@ -20,7 +20,7 @@ * 白白的浪费创建连接和断开连接的时间,增加了系统时延; * 该接口也是非阻塞接口,也就是说,用户拿到DbClient对象时,它管理的连接还没建立起来,框架没有(故意的)提供连接建立成功的回调接口,难道还要sleep一下再开始查询么?这和异步框架的初衷相违背。 -所以,应该在程序开始之初就构建这些对象,并在整个生存周期持有并使用它。显然,这个工作完全可以由框架来做,因此,框架提供了第二种构建方式,就是通过配置文件构建或使用createDbClient接口创建,配置方法见[配置文件](CHN-10-配置文件#db_clients数据库客户端)。 +所以,应该在程序开始之初就构建这些对象,并在整个生存周期持有并使用它。显然,这个工作完全可以由框架来做,因此,框架提供了第二种构建方式,就是通过配置文件构建或使用createDbClient接口创建,配置方法见[配置文件](/CHN/CHN-10-配置文件#db_clients数据库客户端)。 需要使用时,通过框架的接口获得DbClient的智能指针,接口如下(注意该接口必须在app.run()调用后才能得到正确的对象): @@ -252,4 +252,4 @@ internal::SqlBinder operator<<(const std::string &sql); 它虽然也提供阻塞的接口,这种接口只是阻塞调用者线程,只要调用者线程不是EventLoop线程,就不会影响EventLoop线程的正常运转。回调函数被调用时,回调内的程序是运行在EventLoop线程的,所以,不要在回调内部进行任何阻塞操作,否则会影响数据库的并发,熟悉non-blocking I/O编程的人都应该明白这个约束。 -# 08.2 [事务](CHN-08-2-数据库-事务) +# 08.2 [事务](/CHN/CHN-08-2-数据库-事务) diff --git "a/CHN/CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" "b/CHN/CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" index 5eaca12..d44ccf5 100644 --- "a/CHN/CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" +++ "b/CHN/CHN-08-2-\346\225\260\346\215\256\345\272\223-\344\272\213\345\212\241.md" @@ -1,4 +1,4 @@ -[English](ENG-08-2-Database-Transaction) | [简体中文](CHN-08-2-数据库-事务) +[English](/ENG/ENG-08-2-Database-Transaction) | [简体中文](/CHN/CHN-08-2-数据库-事务) > **事务**是关系型数据库的重要特性,Drogon通过`Transaction`类提供了对事务的支持。 @@ -83,4 +83,4 @@ void newTransactionAsync(const std::function } ``` -配置的参数和应用的配置文件一致,请参考[配置文件](CHN-10-配置文件#db_clients)。 +配置的参数和应用的配置文件一致,请参考[配置文件](/CHN/CHN-10-配置文件#db_clients)。 tables配置项是它特有的,是一个字符串数组,每个字符串表示要转化成Model的表名,如果该项为空,则所有的表都会生成对应的Model类。 @@ -99,7 +99,7 @@ template explicit Criteria(const CustomSql &sql, Arguments &&...args) ``` -构造函数的第一个参数是一个包含了占位符`$?`的`CustomSql`对象,而`CustomSql`类只是一个std::string的包装类。第二个不定参数代表绑定的参数,其行为于[execSqlAsync](CHN-08-1-数据库-Dbclient.md#execsqlasync)中的不定参数一致。 +构造函数的第一个参数是一个包含了占位符`$?`的`CustomSql`对象,而`CustomSql`类只是一个std::string的包装类。第二个不定参数代表绑定的参数,其行为于[execSqlAsync](/CHN/CHN-08-1-数据库-Dbclient.md#execsqlasync)中的不定参数一致。 比如: @@ -288,4 +288,4 @@ drogon_ctl还可以在创建model的同时,为每个model(或者说表)生 鉴于这个功能不是那么被普遍需要,这里不做详细介绍了。 -# 08.4 [FastDbClient](CHN-08-4-数据库-FastDbClient) +# 08.4 [FastDbClient](/CHN/CHN-08-4-数据库-FastDbClient) diff --git "a/CHN/CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" "b/CHN/CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" index 0a76ad5..c99e8b4 100644 --- "a/CHN/CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" +++ "b/CHN/CHN-08-4-\346\225\260\346\215\256\345\272\223-FastDbClient.md" @@ -1,4 +1,4 @@ -[English](ENG-08-4-Database-FastDbClient) | [简体中文](CHN-08-4-数据库-FastDbClient) +[English](/ENG/ENG-08-4-Database-FastDbClient) | [简体中文](/CHN/CHN-08-4-数据库-FastDbClient) 顾名思义,FastDbClient会提供比普通的DbClient更高的性能。与DbClient拥有自己的EventLoop不同,它和Web应用的网络IO线程和主线程共用 EventLoop,这使得FastDbClient的内部实现可以采用无锁的方式进行,因而会更高效。 @@ -10,7 +10,7 @@ FastDbClient必须由框架使用框架的接口或通过配置文件创建, 配置文件中的每个db_client配置项下有个is_fast子选项,该选项为true时,表明该对象是FastDbClient。 -框架会针对每个IO事件循环和主事件循环创建单独的FastDbClient,每个FastDbClient内部管理数个数据库连接。IO事件循环数由框架的"threads_num"选择控制,一般设为主机的CPU核心数,每个事件循环管理的数据库连接数由数据库客户端的"connection_number"选项控制,所以一项FastDbClient的总连接数为`(threads_num+1) * connection_number`,参考[配置文件](CHN-10-配置文件#db_clients)。 +框架会针对每个IO事件循环和主事件循环创建单独的FastDbClient,每个FastDbClient内部管理数个数据库连接。IO事件循环数由框架的"threads_num"选择控制,一般设为主机的CPU核心数,每个事件循环管理的数据库连接数由数据库客户端的"connection_number"选项控制,所以一项FastDbClient的总连接数为`(threads_num+1) * connection_number`,参考[配置文件](/CHN/CHN-10-配置文件#db_clients)。 FastDbClient的获取接口和普通DbClient的类似,如下: @@ -30,4 +30,4 @@ FastDbClient的使用与普通的DbClient几乎完全一致,除了下面这些 * 同步的事务创建接口是有可能阻塞的(所有连接都忙的时候),所以FastDbClient的同步事务创建接口直接返回空指针,如果要在FastDbClient上使用事务,请使用异步的事务创建接口。 * 使用FastDbClient创建Orm的Mapper对象后,使用时也要注意只能使用异步非阻塞接口。 -# 08.5 [自动批处理](CHN-08-3-数据库-自动批处理) +# 08.5 [自动批处理](/CHN/CHN-08-3-数据库-自动批处理) diff --git "a/CHN/CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" "b/CHN/CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" index e831494..0fd0a4c 100644 --- "a/CHN/CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" +++ "b/CHN/CHN-08-5-\346\225\260\346\215\256\345\272\223-\350\207\252\345\212\250\346\211\271\345\244\204\347\220\206.md" @@ -1,4 +1,4 @@ -[English](ENG-08-5-Database-auto_batch) | [简体中文](CHN-08-3-数据库-自动批处理) +[English](/ENG/ENG-08-5-Database-auto_batch) | [简体中文](/CHN/CHN-08-3-数据库-自动批处理) 自动批处理模式只对postgresql 14+版本的客户端库有效,其他情况下会被忽略,讲自动批处理之前,先了解一下pipeline模式。 @@ -33,4 +33,4 @@ drogon在1.7.6版本之后开始支持,drogon会自动检查libpq是否支持p 当使用newPgClient接口创建客户端时,把第三个参数设为true即可使能自动批处理模式; 当使用配置文件创建客户端时,把auto_batch选项设为true即可使能该客户端的自动批处理模式; -# 09 [插件](CHN-09-插件) +# 09 [插件](/CHN/CHN-09-插件) diff --git "a/CHN/CHN-09-\346\217\222\344\273\266.md" "b/CHN/CHN-09-\346\217\222\344\273\266.md" index 6e836f6..b2f5d74 100644 --- "a/CHN/CHN-09-\346\217\222\344\273\266.md" +++ "b/CHN/CHN-09-\346\217\222\344\273\266.md" @@ -1,4 +1,4 @@ -[English](ENG-10-Plugins) | [简体中文](CHN-09-插件) +[English](/ENG/ENG-10-Plugins) | [简体中文](/CHN/CHN-09-插件) 插件可以帮助用户构建复杂的应用,在Drogon中,所有的插件都由框架根据配置文件统一构建并安装到应用程序中。Drogon中的插件都是单实例的,用户可以用插件实现任何他们想要的功能。 @@ -76,4 +76,4 @@ auto *pluginPtr=app().getPlugin(); 所有插件在run()接口内初始化完毕,在应用程序退出时才销毁,因此,插件的生命周期几乎和应用程序等同,这也是getPlugin()接口不需要返回智能指针的原因。 -# 10 [配置文件](CHN-10-配置文件) +# 10 [配置文件](/CHN/CHN-10-配置文件) diff --git "a/CHN/CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" "b/CHN/CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" index 81bae25..eb2d808 100644 --- "a/CHN/CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" +++ "b/CHN/CHN-10-\351\205\215\347\275\256\346\226\207\344\273\266.md" @@ -1,4 +1,4 @@ -[English](ENG-11-Configuration-File) | [简体中文](CHN-10-配置文件) +[English](/ENG/ENG-11-Configuration-File) | [简体中文](/CHN/CHN-10-配置文件) 你可以通过DrogonAppFramework实例的多个接口配置各种参数来控制Http服务端的某些行为。不过,使用配置文件是更好的方式,原因如下: @@ -108,7 +108,7 @@ int main() * `dbname`:字符串,数据库名字; * `user`:字符串,用户名; * `passwd`:字符串,密码; - * `is_fast`:bool,默认false,表明该客户端是否是[FastDbClient](CHN-08-4-数据库-FastDbClient); + * `is_fast`:bool,默认false,表明该客户端是否是[FastDbClient](/CHN/CHN-08-4-数据库-FastDbClient); * `connection_number`:到数据库服务端的连接数,至少是1,默认值也是1,影响数据读写的并发量;如果`is_fast`为真,该数值表示每个事件循环的连接数,否则表示总的连接数; * `filename`: sqlite3 数据库的文件名; @@ -286,7 +286,7 @@ int main() * ### simple_controllers_map简单控制器映射 - app子选项,JSON对象数组,每一项表示一个从Http路径到HttpSimpleController的映射,这种配置只是一个可选途径,并不是必须配置在这里,请参阅[HttpSimpleController](CHN-04-1-控制器-HttpSimpleController)。 + app子选项,JSON对象数组,每一项表示一个从Http路径到HttpSimpleController的映射,这种配置只是一个可选途径,并不是必须配置在这里,请参阅[HttpSimpleController](/CHN/CHN-04-1-控制器-HttpSimpleController)。 具体的配置如下: ```json @@ -305,7 +305,7 @@ int main() * `path`:字符串,Http路径; * `controller`:字符串,HttpSimpleController的名字; * `http_methods`:字符串数组,支持的Http方法,这个列表之外的会被过滤掉,返回405错误; - * `filters`:字符串数组,路径上的filter列表,参见[中间件和过滤器](CHN-05-中间件和过滤器); + * `filters`:字符串数组,路径上的filter列表,参见[中间件和过滤器](/CHN/CHN-05-中间件和过滤器); * ### idle_connection_timeout空闲连接超时控制 @@ -329,7 +329,7 @@ int main() * `dynamic_views_path`:布尔值,默认值是false,当为true时,框架会在视图路径中搜索视图文件,并动态编译成so文件,然后加载进应用,当任何视图文件发生变化时,也会引起自动编译和重新加载; * `dynamic_views_path`:字符串数组,每一项表示动态视图的搜索路径,如果路径值不是`/`,`./`或`../`开始的,并且这个值也不是`.`或`..`,则这个路径是前面document_root项的相对路径,否则就是一个绝对路径或者当前目录的相对路径。 - 参见[视图](CHN-06-视图)。 + 参见[视图](/CHN/CHN-06-视图)。 * ### server_header_field头字段 @@ -355,4 +355,4 @@ int main() "pipelining_requests": 0 ``` -# 11 [drogon_ctl 命令](CHN-11-drogon_ctl命令) +# 11 [drogon_ctl 命令](/CHN/CHN-11-drogon_ctl命令) diff --git "a/CHN/CHN-11-drogon_ctl\345\221\275\344\273\244.md" "b/CHN/CHN-11-drogon_ctl\345\221\275\344\273\244.md" index 8263538..2b24b41 100644 --- "a/CHN/CHN-11-drogon_ctl\345\221\275\344\273\244.md" +++ "b/CHN/CHN-11-drogon_ctl\345\221\275\344\273\244.md" @@ -1,4 +1,4 @@ -[English](ENG-12-drogon_ctl-Command) | [简体中文](CHN-11-drogon_ctl命令) +[English](/ENG/ENG-12-drogon_ctl-Command) | [简体中文](/CHN/CHN-11-drogon_ctl命令) **Drogon**框架编译安装后,一个命令行程序 `drogon_ctl` 也同时被安装于系统,为了方便,还安装了一个完全一样的副本 `dg_ctl`。用户可以按喜好自行选用。 @@ -60,7 +60,7 @@ drogon_ctl create model //create model classes in model_path * #### 视图创建 - `dg_ctl create view`命令用于从csp文件生成源文件,参见[视图](CHN-06-视图)一节。一般情况下,该命令不需要直接使用,又cmake文件配置成自动执行是更好的方法。命令例子如下,假设csp文件是`UsersList.csp`. + `dg_ctl create view`命令用于从csp文件生成源文件,参见[视图](/CHN/CHN-06-视图)一节。一般情况下,该命令不需要直接使用,又cmake文件配置成自动执行是更好的方法。命令例子如下,假设csp文件是`UsersList.csp`. ```shell dg_ctl create view UsersList.csp @@ -97,7 +97,7 @@ drogon_ctl create model //create model classes in model_path * #### 过滤器创建 - `dg_ctl create filter`命令用于帮助用户创建过滤器的源文件,参见[中间件和过滤器](CHN-05-中间件和过滤器)一节。 + `dg_ctl create filter`命令用于帮助用户创建过滤器的源文件,参见[中间件和过滤器](/CHN/CHN-05-中间件和过滤器)一节。 ```shell dg_ctl create filter LoginFilter @@ -151,7 +151,7 @@ drogon_ctl create model //create model classes in model_path #include "models/User.h" ``` - 注意要包含models目录名,这是为了区分同一个工程中多个数据源的情况。参见[ORM](CHN-08-3-数据库-ORM)。 + 注意要包含models目录名,这是为了区分同一个工程中多个数据源的情况。参见[ORM](/CHN/CHN-08-3-数据库-ORM)。 ### 压力测试 @@ -169,4 +169,4 @@ dg_ctl press -n1000000 -t4 -c1000 -q http://localhost:8080/ dg_ctl press -n 1000000 -t 4 -c 1000 https://www.domain.com/path/to/be/tested ``` -# 12 [AOP 面向切面编程](CHN-12-AOP面向切面编程) +# 12 [AOP 面向切面编程](/CHN/CHN-12-AOP面向切面编程) diff --git "a/CHN/CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" "b/CHN/CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" index 56e898e..38ef530 100644 --- "a/CHN/CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" +++ "b/CHN/CHN-12-AOP\351\235\242\345\220\221\345\210\207\351\235\242\347\274\226\347\250\213.md" @@ -1,5 +1,5 @@ -[English](ENG-13-AOP-Aspect-Oriented-Programming) -| [简体中文](CHN-12-AOP面向切面编程) +[English](/ENG/ENG-13-AOP-Aspect-Oriented-Programming) +| [简体中文](/CHN/CHN-12-AOP面向切面编程) AOP(面向切面编程)是实现程序功能的统一维护的一种技术。利用AOP可以对业务逻辑的各个部分进行隔离,从而使得业务逻辑各部分之间的耦合度降低,提高程序的可重用性,同时提高了开发的效率。 @@ -15,7 +15,7 @@ Drogon提供了7个插入点供用户使用,当应用程序运行至插入点 * HttpResponseCreation: 注册到这个插入点上的处理程序会在每个HTTP Response对象创建时运行,Advice的调用类型是`void(const HttpResponsePtr &)`,其中的参数就是新创建的对象,用户可以在这个处理程序中对所有Response进行一些统一的操作,比如添加某个特殊的header等,这个插入点会影响所有的Response,包括404或任何drogon内部产生的错误响应,也包括应用产生的所有响应。注册的接口是`registerHttpResponseCreationAdvice`; * Sync: 这个插入点的位置在Http请求处理的最前端,用户可以在这里通过返回一个非空的Response对象来拦截这个请求,Advice调用类型是`HttpRequestPtr(const HttpRequestPtr &)`,注册接口是`registerSyncAdvice`; -* Pre-Routing: 这个插入点的位置在框架为客户端的请求寻找相应的处理器之前,Advice的调用类型有两个,`void(const HttpRequestPtr &,AdviceCallback &&,AdviceChainCallback &&)`和`void(const HttpRequestPtr &)`, 前一个和Filter的doFilter方法的调用类型完全一致,实际上,它们的运行方式也是一样的(请参考[中间件和过滤器](CHN-05-中间件和过滤器)),用户可以通过这种Advice拦截客户端请求或者让它通过,后一种调用类型没有拦截能力,不过消耗更低,如果用户不打算拦截,请选择这种 Advice 注册。注册的接口是`registerPreRoutingAdvice`; +* Pre-Routing: 这个插入点的位置在框架为客户端的请求寻找相应的处理器之前,Advice的调用类型有两个,`void(const HttpRequestPtr &,AdviceCallback &&,AdviceChainCallback &&)`和`void(const HttpRequestPtr &)`, 前一个和Filter的doFilter方法的调用类型完全一致,实际上,它们的运行方式也是一样的(请参考[中间件和过滤器](/CHN/CHN-05-中间件和过滤器)),用户可以通过这种Advice拦截客户端请求或者让它通过,后一种调用类型没有拦截能力,不过消耗更低,如果用户不打算拦截,请选择这种 Advice 注册。注册的接口是`registerPreRoutingAdvice`; * Post-Routing: 这个插入点的位置在找到处理器之后和HTTP方法检测及过滤器处理之前,Advice的调用类型和上个插入点一致,注册接口是`registerPostRoutingAdvice`; * Pre-Handling: 这个插入点的位置在通过了所有过滤器之后和处理器处理之前,Advice的调用类型和上个插入点一致,注册接口是`registerPreHandlingAdvice`; * Post-Handling: 这个插入点的位置在处理器处理完成生成Response之后和发送给客户端之前,Advice的调用类型是`oid(const HttpRequestPtr &, const HttpResponsePtr &)`,注册接口是`registerPostHandlingAdvice`; @@ -26,4 +26,4 @@ Drogon提供了7个插入点供用户使用,当应用程序运行至插入点 ![](images/AOP.png) -# 13 [性能测试](CHN-13-性能测试) +# 13 [性能测试](/CHN/CHN-13-性能测试) diff --git "a/CHN/CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" "b/CHN/CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" index d3fc463..e3ef21b 100644 --- "a/CHN/CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" +++ "b/CHN/CHN-13-\346\200\247\350\203\275\346\265\213\350\257\225.md" @@ -1,4 +1,4 @@ -[English](ENG-14-Benchmarks) | [简体中文](CHN-13-性能测试) +[English](/ENG/ENG-14-Benchmarks) | [简体中文](/CHN/CHN-13-性能测试) 作为C++的Http应用框架,性能应该是关注的重点之一,本节介绍Drogon的简单测试和成绩; @@ -45,4 +45,4 @@ void BenchmarkCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, std::funct ![测试截图](images/benchmark.png) -# 14 [Coz 分析](CHN-14-Coz分析) +# 14 [Coz 分析](/CHN/CHN-14-Coz分析) diff --git "a/CHN/CHN-14-Coz\345\210\206\346\236\220.md" "b/CHN/CHN-14-Coz\345\210\206\346\236\220.md" index 297a515..2c02d77 100644 --- "a/CHN/CHN-14-Coz\345\210\206\346\236\220.md" +++ "b/CHN/CHN-14-Coz\345\210\206\346\236\220.md" @@ -1,4 +1,4 @@ -[English](ENG-15-Coz) | [简体中文](CHN-14-Coz分析) +[English](/ENG/ENG-15-Coz) | [简体中文](/CHN/CHN-14-Coz分析) ## 使用coz进行因果分析 @@ -23,4 +23,4 @@ Coz还支持使用 `--source-scope ` 或 `-s ` 等其他方法 - [Git repo](https://github.com/plasma-umass/coz) - [Coz whitepaper](https://arxiv.org/pdf/1608.03676v1.pdf) -# 15 [Brotli 压缩](CHN-15-Brotil-压缩) +# 15 [Brotli 压缩](/CHN/CHN-15-Brotil-压缩) diff --git "a/CHN/CHN-15-Brotli\345\216\213\347\274\251.md" "b/CHN/CHN-15-Brotli\345\216\213\347\274\251.md" index aeedcbe..528992d 100644 --- "a/CHN/CHN-15-Brotli\345\216\213\347\274\251.md" +++ "b/CHN/CHN-15-Brotli\345\216\213\347\274\251.md" @@ -1,4 +1,4 @@ -[English](ENG-16-Brotli) | [简体中文](CHN-15-Brotli压缩) +[English](/ENG/ENG-16-Brotli) | [简体中文](/CHN/CHN-15-Brotli压缩) ## Brotli压缩 @@ -12,4 +12,4 @@ 不打算使用brotli静态压缩的用户,可能希望摆脱brotli额外的“同名文件检查”,可通过在“config.json”中将“br_static”设置为“false”。 -# 16 [协程]](CHN-16-协程) +# 16 [协程]](/CHN/CHN-16-协程) diff --git "a/CHN/CHN-16-\345\215\217\347\250\213.md" "b/CHN/CHN-16-\345\215\217\347\250\213.md" index ca4d099..b4e5c81 100644 --- "a/CHN/CHN-16-\345\215\217\347\250\213.md" +++ "b/CHN/CHN-16-\345\215\217\347\250\213.md" @@ -1,4 +1,4 @@ -[English](ENG-17-Coroutines) | [简体中文](CHN-16-协程) +[English](/ENG/ENG-17-Coroutines) | [简体中文](/CHN/CHN-16-协程) Drogon从1.4版本开始支持[C++ coroutines][1](协程)。 它提供了扁平化异步执行控制流的方法, 比如,避免著名的`回调地狱callback hell`. 通过协程, 异步编程将像同步编程一样简单(同时保持了异步程序的高性能)。 @@ -166,4 +166,4 @@ app.registerHandler("/num_users", [1]: https://en.cppreference.com/w/cpp/language/coroutines -# 17 [Redis](CHN-17-Redis) +# 17 [Redis](/CHN/CHN-17-Redis) diff --git a/CHN/CHN-17-Redis.md b/CHN/CHN-17-Redis.md index f16695c..0422e98 100644 --- a/CHN/CHN-17-Redis.md +++ b/CHN/CHN-17-Redis.md @@ -1,4 +1,4 @@ -[English](ENG-18-Redis) | [简体中文](CHN-17-Redis) +[English](/ENG/ENG-18-Redis) | [简体中文](/CHN/CHN-17-Redis) Drogon支持Redis,Redis是一种非常快速的内存数据存储。 可以用作数据库缓存或消息代理。 与Drogon中其他组件一樣,Redis的操作是异步的。 这确保了Drogon即使在重负载下也能以非常高的并发性运行。 @@ -101,7 +101,7 @@ redisClient->newTransactionAsync([](const RedisTransactionPtr &transPtr) { ### 协程 -Redis客户端也支持协程. 需要GCC 11或者更新的编译器,并且使用`cmake -DCMAKE_CXX_FLAGS="-std=c++20"` 来使能它。見[协程](CHN-16-协程)取得细节 +Redis客户端也支持协程. 需要GCC 11或者更新的编译器,并且使用`cmake -DCMAKE_CXX_FLAGS="-std=c++20"` 来使能它。見[协程](/CHN/CHN-16-协程)取得细节 ```c++ try @@ -117,4 +117,4 @@ catch(const std::exception& e) } ``` -# [测试框架](CHN-18-测试框架) +# [测试框架](/CHN/CHN-18-测试框架) diff --git "a/CHN/CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" "b/CHN/CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" index 686c2a1..8b7c3a6 100644 --- "a/CHN/CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" +++ "b/CHN/CHN-18-\346\265\213\350\257\225\346\241\206\346\236\266.md" @@ -1,4 +1,4 @@ -[English](ENG-19-Testing-Framework) | [简体中文](CHN-18-测试框架) +[English](/ENG/ENG-19-Testing-Framework) | [简体中文](/CHN/CHN-18-测试框架) DrogonTest是一个内置在Drogon中的最小测试框架,可实现简单的异步测试和同步测试。 它用于Drogon自己的单元测试和集成测试。 但也可用于测试使用Drogon构建的应用程序。 DrogonTest的语法受到[GTest](https://github.com/google/googletest)和[Catch2](https://github.com/catchorg/Catch2)的启发。 diff --git "a/CHN/CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" "b/CHN/CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" index c614eb6..1515343 100644 --- "a/CHN/CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" +++ "b/CHN/CHN-FAQ-1-\347\272\277\347\250\213\346\250\241\345\236\213.md" @@ -1,4 +1,4 @@ -[English](CHS-FAQ-1-Understanding-drogon-threading-model.md) | [简体中文](CHN-FAQ-1-线程模型.md) +[English](CHS-FAQ-1-Understanding-drogon-threading-model.md) | [简体中文](/CHN/CHN-FAQ-1-线程模型.md) # 理解Drogon's的线程模型 diff --git a/CHN/CHN-FAQ.md b/CHN/CHN-FAQ.md index 0033f52..b1f85b9 100644 --- a/CHN/CHN-FAQ.md +++ b/CHN/CHN-FAQ.md @@ -1,4 +1,4 @@ -[English](ENG-FAQ) | [简体中文](CHN-FAQ) +[English](/ENG/ENG-FAQ) | [简体中文](/CHN/CHN-FAQ) # FAQ @@ -6,4 +6,4 @@ ## What's drogon's threading model and best practices? -Drgon在线程池上运行,当调用`app().run()`时,会在该线程池中创建HTTP服务器线程和数据库线程。 它是一个基于顺序任务的系统。 因此,建议在可能的情况下始终使用异步API或协程。 详见[理解drogon的线程模型](CHN-FAQ-1-线程模型)。 +Drgon在线程池上运行,当调用`app().run()`时,会在该线程池中创建HTTP服务器线程和数据库线程。 它是一个基于顺序任务的系统。 因此,建议在可能的情况下始终使用异步API或协程。 详见[理解drogon的线程模型](/CHN/CHN-FAQ-1-线程模型)。 diff --git a/CHN/Home.zh-CN.md b/CHN/Home.zh-CN.md index 688f66c..1a2e280 100644 --- a/CHN/Home.zh-CN.md +++ b/CHN/Home.zh-CN.md @@ -1,80 +1,80 @@ [English](Home) | [简体中文](Home.zh-CN) -### [欢迎使用 Drogon!](CHN-01-概述) +### [欢迎使用 Drogon!](/CHN/CHN-01-概述) -* [概述](CHN-01-概述) -* [安装 drogon](CHN-02-安装) - * [系统要求](CHN-02-安装#系统要求) - * [依赖库](CHN-02-安装#依赖库) - * [系统准备范例](CHN-02-安装#系统准备范例) - * [Ubuntu](CHN-02-安装#Ubuntu-1804) - * [CentOS](CHN-02-安装#CentOS-75) - * [MacOS](CHN-02-安装#MacOS-122) - * [Windows](CHN-02-安装#Windows) - * [数据库环境](CHN-02-安装#数据库环境) - * [PostgreSQL](CHN-02-安装#PostgreSQL) - * [MySQL](CHN-02-安装#MySQL) - * [SQLite3](CHN-02-安装#SQLite3) - * [Redis](CHN-02-安装#Redis) - * [安装 drogon](CHN-02-安装#安装drogon) - * [Linux源码安装](CHN-02-安装#Linux源码安装) - * [Windows源码安装](CHN-02-安装#Windows源码安装) - * [Windows vcpkg安装](CHN-02-安装#Windows-vcpkg安装) - * [使用docker镜像](CHN-02-安装#使用docker镜像) - * [使用Nix包](CHN-02-安装#使用Nix包) - * [使用CPM.cmake](CHN-02-安装#使用CPM.cmake) - * [直接包含drogon源码](CHN-02-安装#直接包含drogon源码) -* [快速开始](CHN-03-快速开始) - * [静态网站](CHN-03-快速开始#静态网站) - * [动态网站](CHN-03-快速开始#动态网站) -* [控制器](CHN-04-0-控制器-简介) - * [HttpSimpleController](CHN-04-1-控制器-HttpSimpleController) - * [HttpController](CHN-04-2-控制器-HttpController) - * [路径映射](CHN-04-2-控制器-HttpController#路径映射) - * [参数映射](CHN-04-2-控制器-HttpController#参数映射) - * [多路径映射](CHN-04-2-控制器-HttpController#多路径映射) - * [正则表达式映射](CHN-04-2-控制器-HttpController#正则表达式映射) - * [WebSocketController](CHN-04-3-控制器-WebSocketController) - * [路径映射](CHN-04-3-控制器-WebSocketController#路径映射) - * [接口](CHN-04-3-控制器-WebSocketController#接口) -* [中间件和过滤器](CHN-05-中间件和过滤器) - * [内置中间件/过滤器](CHN-05-中间件和过滤器#内置中间件/过滤器) - * [自定义中间件/过滤器](CHN-05-中间件和过滤器#自定义中间件/过滤器) -* [视图](CHN-06-视图) - * [Drogon的csp](CHN-06-视图#Drogon的csp) - * [csp文件的自动化处理](CHN-06-视图#csp文件的自动化处理) - * [视图的动态编译和加载](CHN-06-视图#视图的动态编译和加载) -* [会话](CHN-07-会话) -* [数据库](CHN-08-0-数据库-概述) - * [DbClient](CHN-08-1-数据库-DbClient) - * [执行接口](ENG-08-1-数据库-DbClient#执行接口) - * [execSqlAsync](ENG-08-1-数据库-DbClient#execSqlAsync) - * [execSqlAsyncFuture](ENG-08-1-数据库-DbClient#execSqlAsyncFuture) - * [execSqlSync](ENG-08-1-数据库-DbClient#execSqlSync) - * [operator<<](ENG-08-1-数据库-DbClient#operator<<) - * [事务](CHN-08-2-数据库-事务) - * [ORM](CHN-08-3-数据库-ORM) - * [Model类的接口](CHN-08-3-数据库-ORM#Model类的接口) - * [Mapper类模板](CHN-08-3-数据库-ORM#Mapper类模板) - * [条件对象](CHN-08-3-数据库-ORM#条件对象) - * [Mapper 的链式接口](CHN-08-3-数据库-ORM#Mapper的链式接口) - * [转换](CHN-08-3-数据库-ORM#转换) - * [关系](CHN-08-3-数据库-ORM#关系) - * [has one](CHN-08-3-数据库-ORM#has-one) - * [has many](CHN-08-3-数据库-ORM#has-many) - * [many to many](CHN-08-3-数据库-ORM#many-to-many) - * [FastDbClient](CHN-08-4-数据库-FastDbClient) - * [自动批处理模式](CHN-08-5-数据库-自动批处理) -* [插件](CHN-09-插件) -* [配置文件](CHN-10-配置文件) -* [drogon_ctl命令](CHN-11-drogon_ctl命令) -* [AOP面向切面编程](CHN-12-AOP面向切面编程) -* [性能测试](CHN-13-性能测试) -* [协程](CHN-16-协程) -* [Redis](CHN-17-Redis) -* [测试框架](CHN-18-测试框架) -* [FAQ](CHN-FAQ) - * [drogon的线程模型](CHN-FAQ-1-线程模型) +* [概述](/CHN/CHN-01-概述) +* [安装 drogon](/CHN/CHN-02-安装) + * [系统要求](/CHN/CHN-02-安装#系统要求) + * [依赖库](/CHN/CHN-02-安装#依赖库) + * [系统准备范例](/CHN/CHN-02-安装#系统准备范例) + * [Ubuntu](/CHN/CHN-02-安装#Ubuntu-1804) + * [CentOS](/CHN/CHN-02-安装#CentOS-75) + * [MacOS](/CHN/CHN-02-安装#MacOS-122) + * [Windows](/CHN/CHN-02-安装#Windows) + * [数据库环境](/CHN/CHN-02-安装#数据库环境) + * [PostgreSQL](/CHN/CHN-02-安装#PostgreSQL) + * [MySQL](/CHN/CHN-02-安装#MySQL) + * [SQLite3](/CHN/CHN-02-安装#SQLite3) + * [Redis](/CHN/CHN-02-安装#Redis) + * [安装 drogon](/CHN/CHN-02-安装#安装drogon) + * [Linux源码安装](/CHN/CHN-02-安装#Linux源码安装) + * [Windows源码安装](/CHN/CHN-02-安装#Windows源码安装) + * [Windows vcpkg安装](/CHN/CHN-02-安装#Windows-vcpkg安装) + * [使用docker镜像](/CHN/CHN-02-安装#使用docker镜像) + * [使用Nix包](/CHN/CHN-02-安装#使用Nix包) + * [使用CPM.cmake](/CHN/CHN-02-安装#使用CPM.cmake) + * [直接包含drogon源码](/CHN/CHN-02-安装#直接包含drogon源码) +* [快速开始](/CHN/CHN-03-快速开始) + * [静态网站](/CHN/CHN-03-快速开始#静态网站) + * [动态网站](/CHN/CHN-03-快速开始#动态网站) +* [控制器](/CHN/CHN-04-0-控制器-简介) + * [HttpSimpleController](/CHN/CHN-04-1-控制器-HttpSimpleController) + * [HttpController](/CHN/CHN-04-2-控制器-HttpController) + * [路径映射](/CHN/CHN-04-2-控制器-HttpController#路径映射) + * [参数映射](/CHN/CHN-04-2-控制器-HttpController#参数映射) + * [多路径映射](/CHN/CHN-04-2-控制器-HttpController#多路径映射) + * [正则表达式映射](/CHN/CHN-04-2-控制器-HttpController#正则表达式映射) + * [WebSocketController](/CHN/CHN-04-3-控制器-WebSocketController) + * [路径映射](/CHN/CHN-04-3-控制器-WebSocketController#路径映射) + * [接口](/CHN/CHN-04-3-控制器-WebSocketController#接口) +* [中间件和过滤器](/CHN/CHN-05-中间件和过滤器) + * [内置中间件/过滤器](/CHN/CHN-05-中间件和过滤器#内置中间件/过滤器) + * [自定义中间件/过滤器](/CHN/CHN-05-中间件和过滤器#自定义中间件/过滤器) +* [视图](/CHN/CHN-06-视图) + * [Drogon的csp](/CHN/CHN-06-视图#Drogon的csp) + * [csp文件的自动化处理](/CHN/CHN-06-视图#csp文件的自动化处理) + * [视图的动态编译和加载](/CHN/CHN-06-视图#视图的动态编译和加载) +* [会话](/CHN/CHN-07-会话) +* [数据库](/CHN/CHN-08-0-数据库-概述) + * [DbClient](/CHN/CHN-08-1-数据库-DbClient) + * [执行接口](/ENG/ENG-08-1-数据库-DbClient#执行接口) + * [execSqlAsync](/ENG/ENG-08-1-数据库-DbClient#execSqlAsync) + * [execSqlAsyncFuture](/ENG/ENG-08-1-数据库-DbClient#execSqlAsyncFuture) + * [execSqlSync](/ENG/ENG-08-1-数据库-DbClient#execSqlSync) + * [operator<<](/ENG/ENG-08-1-数据库-DbClient#operator<<) + * [事务](/CHN/CHN-08-2-数据库-事务) + * [ORM](/CHN/CHN-08-3-数据库-ORM) + * [Model类的接口](/CHN/CHN-08-3-数据库-ORM#Model类的接口) + * [Mapper类模板](/CHN/CHN-08-3-数据库-ORM#Mapper类模板) + * [条件对象](/CHN/CHN-08-3-数据库-ORM#条件对象) + * [Mapper 的链式接口](/CHN/CHN-08-3-数据库-ORM#Mapper的链式接口) + * [转换](/CHN/CHN-08-3-数据库-ORM#转换) + * [关系](/CHN/CHN-08-3-数据库-ORM#关系) + * [has one](/CHN/CHN-08-3-数据库-ORM#has-one) + * [has many](/CHN/CHN-08-3-数据库-ORM#has-many) + * [many to many](/CHN/CHN-08-3-数据库-ORM#many-to-many) + * [FastDbClient](/CHN/CHN-08-4-数据库-FastDbClient) + * [自动批处理模式](/CHN/CHN-08-5-数据库-自动批处理) +* [插件](/CHN/CHN-09-插件) +* [配置文件](/CHN/CHN-10-配置文件) +* [drogon_ctl命令](/CHN/CHN-11-drogon_ctl命令) +* [AOP面向切面编程](/CHN/CHN-12-AOP面向切面编程) +* [性能测试](/CHN/CHN-13-性能测试) +* [协程](/CHN/CHN-16-协程) +* [Redis](/CHN/CHN-17-Redis) +* [测试框架](/CHN/CHN-18-测试框架) +* [FAQ](/CHN/CHN-FAQ) + * [drogon的线程模型](/CHN/CHN-FAQ-1-线程模型) ### 想要为此wiki做出贡献,请访问[drogon-docs](https://github.com/drogonframework/drogon-docs)仓库。 diff --git a/ENG/ENG-01-Overview.md b/ENG/ENG-01-Overview.md index 7bd22a2..9c920c1 100644 --- a/ENG/ENG-01-Overview.md +++ b/ENG/ENG-01-Overview.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-01-概述) +##### Other languages: [简体中文](/CHN//CHN//CHN/CHN-01-概述) **Drogon** is a C++17/20-based HTTP application framework. Drogon can be used to easily build various types of web application server programs using C++. @@ -31,4 +31,4 @@ Its main features are as follows: * Support plugins which can be installed by the configuration file at load time; * Support AOP with build-in joinpoints. -# Next: [Install drogon](/ENG//ENG/ENG-02-Installation) +# Next: [Install drogon](/ENG//ENG//ENG/ENG-02-Installation) diff --git a/ENG/ENG-02-Installation.md b/ENG/ENG-02-Installation.md index b5c1678..96afd0a 100644 --- a/ENG/ENG-02-Installation.md +++ b/ENG/ENG-02-Installation.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-02-安装) +##### Other languages: [简体中文](/CHN//CHN//CHN/CHN-02-安装) This section takes Ubuntu 18.04, CentOS 7.5, MacOS 12.2 as an example to introduce the installation process. Other systems are similar; @@ -481,4 +481,4 @@ Assuming that the above environment and library dependencies are all ready, the target_link_libraries(${PROJECT_NAME} PRIVATE drogon) ``` -# Next: [Quick Start](/ENG//ENG/ENG-03-Quick-Start) +# Next: [Quick Start](/ENG//ENG//ENG/ENG-03-Quick-Start) diff --git a/ENG/ENG-03-Quick-Start.md b/ENG/ENG-03-Quick-Start.md index 224fbd4..9cd9ca2 100644 --- a/ENG/ENG-03-Quick-Start.md +++ b/ENG/ENG-03-Quick-Start.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-03-快速开始) +##### Other languages: [简体中文](/CHN//CHN//CHN/CHN-03-快速开始) ## Static Site @@ -22,7 +22,7 @@ There are several useful folders in the project directory already: └── views The folder where view csp files are stored ``` -Users can put various files (such as controllers, filters, views, etc.) into the corresponding folders. For more convenience and less error, we strongly recommend that users create their own web application projects using the `drogon_ctl` command. See [drogon_ctl](/ENG/ENG-11-drogon_ctl-Command) for more details. +Users can put various files (such as controllers, filters, views, etc.) into the corresponding folders. For more convenience and less error, we strongly recommend that users create their own web application projects using the `drogon_ctl` command. See [drogon_ctl](/ENG//ENG/ENG-11-drogon_ctl-Command) for more details. Let's look at the main.cc file: @@ -55,7 +55,7 @@ Now, we simply add one static file index.html to the Http root path: echo '

Hello Drogon!

' >>index.html ``` -The default root path is `"./"`, but could also be modified by config.json. See [Configuration File](/ENG/ENG-10-Configuration-File) for more details. Then you can visit this page by URL `"http://localhost"` or`"http://localhost/index.html"` (or the IP of the server where your wepapp is running). +The default root path is `"./"`, but could also be modified by config.json. See [Configuration File](/ENG//ENG/ENG-10-Configuration-File) for more details. Then you can visit this page by URL `"http://localhost"` or`"http://localhost/index.html"` (or the IP of the server where your wepapp is running). ![Hello Drogon!](images/hellodrogon.png) @@ -194,4 +194,4 @@ We see that adding a controller to an application is very simple. You only need > **Note: Drogon has no restrictions on the location of the controller source files. You could also save them in "./" (the project root directory), or you could even define a new directory in `CMakeLists.txt`. It is recommended to use the controllers directory for the convenience of management.** -# Next: [drogon_ctl Command](/ENG/ENG-04-0-Controller-Introduction) +# Next: [drogon_ctl Command](/ENG//ENG/ENG-04-0-Controller-Introduction) diff --git a/ENG/ENG-04-0-Controller-Introduction.md b/ENG/ENG-04-0-Controller-Introduction.md index ca7fd0a..01462fc 100644 --- a/ENG/ENG-04-0-Controller-Introduction.md +++ b/ENG/ENG-04-0-Controller-Introduction.md @@ -1,6 +1,6 @@ -##### Other languages: [简体中文](/CHN/CHN-04-控制器-简介) +##### Other languages: [简体中文](/CHN//CHN/CHN-04-控制器-简介) -The controller is very important in web application development. This is where we will define our URLs, which HTTP methods are allowed, which [filters](/ENG/ENG-06-Middleware-and-Filter) will be applied and how requests will be processed and responded to. The drogon framework has helped us to handle the network transmission, Http protocol analysis and so on. We only need to pay attention to the logic of the controller; each controller object can have one or more processing functions (generally called handlers), and the interface of the function is generally defined as follows: +The controller is very important in web application development. This is where we will define our URLs, which HTTP methods are allowed, which [filters](/ENG//ENG/ENG-06-Middleware-and-Filter) will be applied and how requests will be processed and responded to. The drogon framework has helped us to handle the network transmission, Http protocol analysis and so on. We only need to pay attention to the logic of the controller; each controller object can have one or more processing functions (generally called handlers), and the interface of the function is generally defined as follows: ```c++ Void handlerName(const HttpRequestPtr &req, @@ -33,4 +33,4 @@ public: A controller registered to a drogon framework will have at most only one instance and will not be destroyed during the entire application run, so users can declare and use member variables in the controller class. Note that when the handler of the controller is called, it is in a multi-threaded environment (when the number of IO threads of the framework is configured to be greater than 1), if you need to access non-temporary variables, please do the concurrent protection work. -# Next: [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) +# Next: [HttpSimpleController](/ENG//ENG/ENG-04-1-Controller-HttpSimpleController) diff --git a/ENG/ENG-04-1-Controller-HttpSimpleController.md b/ENG/ENG-04-1-Controller-HttpSimpleController.md index db4afa9..f206169 100644 --- a/ENG/ENG-04-1-Controller-HttpSimpleController.md +++ b/ENG/ENG-04-1-Controller-HttpSimpleController.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-04-1-控制器-HttpSimpleController) +##### Other languages: [简体中文](/CHN//CHN/CHN-04-1-控制器-HttpSimpleController) You could use the `drogon_ctl` command line tool to quickly generate custom controller class source files based on `HttpSimpleController`. The command format is as bellow: @@ -47,7 +47,7 @@ Each HttpSimpleController class can only define one Http request handler, and it The route (or called mapping) from the URL path to the handler is done by a macro. You could add multipath mappings with the `PATH_ADD` macro. All `PATH_ADD` statements should be set between the `PATH_LIST_BEGIN` and `PATH_LIST_END` macro statements. -The first parameter is the path to be mapped, and parameters beyond the path are constraints on this path. Currently, two types of constraints are supported. One is the `HttpMethod` enum Type, which means the Http method allowed. The other type is the name of the `HttpFilter` class. One can configure any number of these two types of constraints, and there are no order requirements for them. For Filter, please refer to [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter). +The first parameter is the path to be mapped, and parameters beyond the path are constraints on this path. Currently, two types of constraints are supported. One is the `HttpMethod` enum Type, which means the Http method allowed. The other type is the name of the `HttpFilter` class. One can configure any number of these two types of constraints, and there are no order requirements for them. For Filter, please refer to [Middleware and Filter](/ENG//ENG/ENG-05-Middleware-and-Filter). Users can register the same Simple Controller to multiple paths, or register multiple Simple Controllers on the same path (using different HTTP methods). @@ -64,4 +64,4 @@ You could define an HttpResponse class variable, and then use the callback() to > **The mapping from the above path to the handler is done at compile time. In fact, the drogon framework also provides an interface for runtime completion mapping. The runtime mapping allows the user to map or modify the mapping through configuration files or other user interfaces without recompiling this program (For performance reasons, it is forbidden to add any controller mapping after running the app().run() method).** -# Next: [HttpController](/ENG/ENG-04-2-Controller-HttpController) +# Next: [HttpController](/ENG//ENG/ENG-04-2-Controller-HttpController) diff --git a/ENG/ENG-04-2-Controller-HttpController.md b/ENG/ENG-04-2-Controller-HttpController.md index c5b9177..65f96b6 100644 --- a/ENG/ENG-04-2-Controller-HttpController.md +++ b/ENG/ENG-04-2-Controller-HttpController.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-04-2-控制器-HttpController) +##### Other languages: [简体中文](/CHN//CHN/CHN-04-2-控制器-HttpController) ### Generation @@ -279,4 +279,4 @@ Each `HttpController` class can define many Http request handlers. Since the num > **It should be noted that when using regular expressions, you should pay attention to matching conflicts (multiple different handlers are matched). When conflicts happen in the same controller, drogon will only execute the first handler (the one registered in the framework first). When conflicts happen between different controllers, it is uncertain which handler will be executed. Therefore, users need to avoid these conflicts.** -# Next: [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) +# Next: [WebSocketController](/ENG//ENG/ENG-04-3-Controller-WebSocketController) diff --git a/ENG/ENG-04-3-Controller-WebSocketController.md b/ENG/ENG-04-3-Controller-WebSocketController.md index 2d62efe..ff86940 100644 --- a/ENG/ENG-04-3-Controller-WebSocketController.md +++ b/ENG/ENG-04-3-Controller-WebSocketController.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-04-3-控制器-WebSocketController) +##### Other languages: [简体中文](/CHN//CHN/CHN-04-3-控制器-WebSocketController) As the name implies, `WebSocketController` is used to process websocket logic. Websocket is a persistent HTTP-based connection scheme. At the beginning of the websocket, there is an HTTP format request and response exchange. After the websocket connection is established, all messages are transmitted on the websocket. The message is wrapped in a fixed format. There is no limit to the message content and the order in which messages are transmitted. @@ -100,7 +100,7 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr } ``` - First, in this example, the controller is registered to the `/echo` path via the `WS_PATH_ADD` macro. The usage of the `WS_PATH_ADD` macro is similar to the macros of other controllers introduced earlier. One can also register the path with several [Filters](/ENG/ENG-05-Middleware-and-Filter). Since websocket is handled separately in the framework, it can be repeated with the paths of the first two controllers(`HttpSimpleController` and `HttpApiController`) without affecting each other. + First, in this example, the controller is registered to the `/echo` path via the `WS_PATH_ADD` macro. The usage of the `WS_PATH_ADD` macro is similar to the macros of other controllers introduced earlier. One can also register the path with several [Filters](/ENG//ENG/ENG-05-Middleware-and-Filter). Since websocket is handled separately in the framework, it can be repeated with the paths of the first two controllers(`HttpSimpleController` and `HttpApiController`) without affecting each other. Secondly, in the implementation of the three virtual functions in this example, only the handleNewMessage has the substance, but simply sends the received message back to the client through the send interface.Compile this controller into the framework, you can see the effect, please test it yourself. @@ -150,4 +150,4 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr any *getMutableContext(); ``` -# Next: [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) +# Next: [Middleware and Filter](/ENG//ENG/ENG-05-Middleware-and-Filter) diff --git a/ENG/ENG-05-Middleware-and-Filter.md b/ENG/ENG-05-Middleware-and-Filter.md index 92b8d04..4173cd8 100644 --- a/ENG/ENG-05-Middleware-and-Filter.md +++ b/ENG/ENG-05-Middleware-and-Filter.md @@ -1,6 +1,6 @@ -##### Other languages: [简体中文](/CHN/CHN-05-中间件和过滤器) +##### Other languages: [简体中文](/CHN//CHN/CHN-05-中间件和过滤器) -In HttpController's [example](/ENG/ENG-04-2-Controller-HttpController), the getInfo method should check whether the user is logged in before returning the user's information. We can write this logic in the getInfo method, but obviously, checking the user's login membership is general logic which will be used by many interfaces, it should be extracted separately and configured before calling handler, which is what filters do. +In HttpController's [example](/ENG//ENG/ENG-04-2-Controller-HttpController), the getInfo method should check whether the user is logged in before returning the user's information. We can write this logic in the getInfo method, but obviously, checking the user's login membership is general logic which will be used by many interfaces, it should be extracted separately and configured before calling handler, which is what filters do. Drogon's middleware uses the onion model. After the framework completes URL path matching, it sequentially invokes the middleware registered for that path. Within each middleware, users can choose to intercept or pass through the request and add pre-processing and post-processing logic. @@ -71,7 +71,7 @@ Drogon contains the following common filters: }; ``` - You could create filter by the `drogon_ctl` command, see [drogon_ctl](/ENG/ENG-11-drogon_ctl-command#Filter-creation). + You could create filter by the `drogon_ctl` command, see [drogon_ctl](/ENG//ENG/ENG-11-drogon_ctl-command#Filter-creation). You need to override the doFilter virtual function of the parent class to implement the filter logic; @@ -100,4 +100,4 @@ Drogon contains the following common filters: > **Note: If the middleware/filter is defined in the namespace, you must write the namespace completely when you register it.** -# Next: [View](/ENG/ENG-06-View) +# Next: [View](/ENG//ENG/ENG-06-View) diff --git a/ENG/ENG-06-View.md b/ENG/ENG-06-View.md index 628de19..da77524 100644 --- a/ENG/ENG-06-View.md +++ b/ENG/ENG-06-View.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-06-视图) +##### Other languages: [简体中文](/CHN//CHN/CHN-06-视图) ### Views Introduction @@ -151,4 +151,4 @@ Obviously, this function depends on the development environment. If both drogon > **Note: If a `symbol not found` error occurs while loading a dynamic view, please use the `cmake .. -DCMAKE_ENABLE_EXPORTS=on` to configure your project, or uncomment the last line (`set_property(TARGET ${PROJECT_NAME} PROPERTY ENABLE_EXPORTS ON)`) in your project's CMakeLists.txt, and then rebuild the project** -# Next: [Session](/ENG/ENG-07-Session) +# Next: [Session](/ENG//ENG/ENG-07-Session) diff --git a/ENG/ENG-07-Session.md b/ENG/ENG-07-Session.md index 8eee5ab..89b0e58 100644 --- a/ENG/ENG-07-Session.md +++ b/ENG/ENG-07-Session.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-07-会话) +##### Other languages: [简体中文](/CHN//CHN/CHN-07-会话) `Session` is an important concept of the web application. It is used to save the state of the client on the server. Generally, it cooperates with the browser's `cookie`, and drogon provides support for the session. Drogon **close** the session selection by default, you can also close or open it through the following interface: @@ -96,4 +96,4 @@ drogon::HttpAppFramework::instance().enableSession(1200); Recompile the entire project with CMake, run the target program webapp, and you can see the effect through the browser. -# Next: [Database](/ENG/ENG-08-0-Database-General) +# Next: [Database](/ENG//ENG/ENG-08-0-Database-General) diff --git a/ENG/ENG-08-0-Database-General.md b/ENG/ENG-08-0-Database-General.md index 928d278..924e3b2 100644 --- a/ENG/ENG-08-0-Database-General.md +++ b/ENG/ENG-08-0-Database-General.md @@ -1,8 +1,8 @@ -##### Other languages: [简体中文](/CHN/CHN-08-0-数据库-概述) +##### Other languages: [简体中文](/CHN//CHN/CHN-08-0-数据库-概述) ### General -**Drogon** has built-in database read/write engine. The operation of database connection is based on non-blocking I/O technology. Therefore, the application works in an efficient non-blocking asynchronous mode from the bottom to the upper layer, which ensures Drogon's high concurrency performance. Currently, Drogon supports PostgreSQL and MySQL databases. If you want to use a database, the development environment of the corresponding database must be installed first. Drogon will automatically detect the header files and library files of these libraries and compile the corresponding parts. For the preparation of the database development environment, see [Development Environment](/ENG/ENG-02-Installation#Database-Environment). +**Drogon** has built-in database read/write engine. The operation of database connection is based on non-blocking I/O technology. Therefore, the application works in an efficient non-blocking asynchronous mode from the bottom to the upper layer, which ensures Drogon's high concurrency performance. Currently, Drogon supports PostgreSQL and MySQL databases. If you want to use a database, the development environment of the corresponding database must be installed first. Drogon will automatically detect the header files and library files of these libraries and compile the corresponding parts. For the preparation of the database development environment, see [Development Environment](/ENG//ENG/ENG-02-Installation#Database-Environment). **Drogon** supports the sqlite3 database in order to support lightweight applications. The asynchronous interface is implemented through the thread pool, which is the same as the interfaces of the aforementioned databases. @@ -14,14 +14,14 @@ The basic class of Drogon's database is `DbClient` (this is an abstract class, t Usually, when an asynchronous interface is called, `DbClient` will randomly select one of the idle connections it manages to perform related query operations. When the result returns, `DbClient` will process the data and return it to the caller through the callback function object; Without an idle connection, the execution content will be cached. Once a connection has executed its own sql request, the pending command will be fetched from the cache to execute. -For details on `DbClient`, see [DbClient](/ENG/ENG-08-1-Database-DbClient). +For details on `DbClient`, see [DbClient](/ENG//ENG/ENG-08-1-Database-DbClient). ### Transaction -The transaction object can be generated by `DbClient` to support transaction operations. In addition to the extra `rollback()` interface, the transaction object is basically the same as `DbClient`. The transaction class is `Transaction`. For details of the `Transaction` class, see [Transaction](/ENG/ENG-08-2-Database-Transaction). +The transaction object can be generated by `DbClient` to support transaction operations. In addition to the extra `rollback()` interface, the transaction object is basically the same as `DbClient`. The transaction class is `Transaction`. For details of the `Transaction` class, see [Transaction](/ENG//ENG/ENG-08-2-Database-Transaction). ### ORM -Drogon also provides support for **ORM**. Users can use the drogon_ctl command to read the tables in the database and generate the corresponding model source code. Then, execute the database operations of these models through the `Mapper` class template. Mapper provides simple and convenient interfaces for standard database operations, allowing users to make the additions, deletions, and changes to the table without writing sql statements. For **ORM**, please refer to [ORM](/ENG/ENG-08-3-Database-ORM) +Drogon also provides support for **ORM**. Users can use the drogon_ctl command to read the tables in the database and generate the corresponding model source code. Then, execute the database operations of these models through the `Mapper` class template. Mapper provides simple and convenient interfaces for standard database operations, allowing users to make the additions, deletions, and changes to the table without writing sql statements. For **ORM**, please refer to [ORM](/ENG//ENG/ENG-08-3-Database-ORM) -# Next: [DbClient](/ENG/ENG-08-1-Database-DbClient) +# Next: [DbClient](/ENG//ENG/ENG-08-1-Database-DbClient) diff --git a/ENG/ENG-08-1-Database-DbClient.md b/ENG/ENG-08-1-Database-DbClient.md index e0f2f98..ff68808 100644 --- a/ENG/ENG-08-1-Database-DbClient.md +++ b/ENG/ENG-08-1-Database-DbClient.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-08-1-数据库-DbClient) +##### Other languages: [简体中文](/CHN//CHN/CHN-08-1-数据库-DbClient) ### DbClient Object Construction @@ -20,7 +20,7 @@ The object obtained by the above method, the user has to find a way to persist i - This will waste time creating connections and disconnections, increasing system latency; - The interface is also a non-blocking interface. That is to say, when the user gets the DbClient object, the connection managed by the it has not been established yet. The framework does not (intentionally) provide a callback interface for successful connection establishment. Do you still have to sleep before starting the query?? This is contrary to the original intention of the asynchronous framework. -Therefore, DbClient objects should be built at the beginning of the program and held and used throughout the life time. Obviously, this work can be done entirely by the framework. So the drogon framework provides the second build method, which is built by configuration file or the `createDbClient()` method. For the configuration method of the configuration file, see [db_clients](/ENG/ENG-10-Configuration-file#db_clients). +Therefore, DbClient objects should be built at the beginning of the program and held and used throughout the life time. Obviously, this work can be done entirely by the framework. So the drogon framework provides the second build method, which is built by configuration file or the `createDbClient()` method. For the configuration method of the configuration file, see [db_clients](/ENG//ENG/ENG-10-Configuration-file#db_clients). When needed, the DbClient smart pointer is obtained through the interface of the framework. The interface is as follows: @@ -253,4 +253,4 @@ Each DbClient object has one or multiple its own EventLoop threads controlling t Blocking interfaces of DbClient only block the caller thread, as long as the caller thread is not the EventLoop thread, it will not affect the normal operation of the EventLoop thread. When the callback function is called, the program inside the callback is run on the EventLoop thread. Therefore, do not perform any blocking operations within the callback, otherwise it will affect the concurrency performance of database read and write. Anyone familiar with non-blocking I/O programming should understand this constraint. -# Next: [Transaction](/ENG/ENG-08-2-Database-Transaction) +# Next: [Transaction](/ENG//ENG/ENG-08-2-Database-Transaction) diff --git a/ENG/ENG-08-2-Database-Transaction.md b/ENG/ENG-08-2-Database-Transaction.md index 6112d6a..fa54aac 100644 --- a/ENG/ENG-08-2-Database-Transaction.md +++ b/ENG/ENG-08-2-Database-Transaction.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-08-2-数据库-事务) +##### Other languages: [简体中文](/CHN//CHN/CHN-08-2-数据库-事务) > **Transactions** are an important feature of relational databases, and Drogon provides transaction support with the `Transaction` class. @@ -83,4 +83,4 @@ For the simplest example, suppose there is a task table from which the user sele In this case, select for update is used to avoid concurrent modifications. The update statement is completed in the result callback of the select statement. The outermost braces are used to limit the scope of the transPtr so that it can be destroyed in time after the execution of sql to end the transaction. -# Next: [ORM](/ENG/ENG-08-3-Database-ORM) +# Next: [ORM](/ENG//ENG/ENG-08-3-Database-ORM) diff --git a/ENG/ENG-08-3-Database-ORM.md b/ENG/ENG-08-3-Database-ORM.md index cd0e9d0..0add918 100644 --- a/ENG/ENG-08-3-Database-ORM.md +++ b/ENG/ENG-08-3-Database-ORM.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-08-3-数据库-ORM) +##### Other languages: [简体中文](/CHN//CHN/CHN-08-3-数据库-ORM) ### Model @@ -30,7 +30,7 @@ The last parameter is the path to store model classes. There must be a configura } ``` -The configured parameters are the same as the application's configuration file. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). +The configured parameters are the same as the application's configuration file. Please refer to [Configuration File](/ENG//ENG/ENG-10-Configuration-File#db_clients). The `tables` configuration option is unique to the model configuration. It is an array of strings. Each string represents the name of the table to be converted into a model class. If this option is empty, all tables will be used to generate model classes. @@ -99,7 +99,7 @@ template explicit Criteria(const CustomSql &sql, Arguments &&...args) ``` -The first argument is a `CustomSql` object of sql statements with `$?` placeholders, while the `CustomSql` class is just a wrapper of a std::string. The second indefinite argument is a parameter pack represents the bound parameter, which behaves just like the ones in [execSqlAsync](/ENG/ENG-08-1-Database-DbClient.md#execSqlAsync). +The first argument is a `CustomSql` object of sql statements with `$?` placeholders, while the `CustomSql` class is just a wrapper of a std::string. The second indefinite argument is a parameter pack represents the bound parameter, which behaves just like the ones in [execSqlAsync](/ENG//ENG/ENG-08-1-Database-DbClient.md#execSqlAsync). E.g: @@ -286,4 +286,4 @@ drogon_ctl can also generate restful-style controllers for each model (or table) It should be noted that the controller of each table is designed to be composed of a base class and a subclass. Among them, the base class and the table are closely related, and the subclass is used to implement special business logic or modify the interface format. The advantage of this design is that when the table structure changes, users can update only the base class without overwriting the subclass(by setting the `generate_base_only` option to `true`). -# Next: [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) +# Next: [FastDbClient](/ENG//ENG/ENG-08-4-Database-FastDbClient) diff --git a/ENG/ENG-08-4-Database-FastDbClient.md b/ENG/ENG-08-4-Database-FastDbClient.md index bc4d82a..07922ac 100644 --- a/ENG/ENG-08-4-Database-FastDbClient.md +++ b/ENG/ENG-08-4-Database-FastDbClient.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-08-4-数据库-FastDbClient) +##### Other languages: [简体中文](/CHN//CHN/CHN-08-4-数据库-FastDbClient) As the name implies, FastDbClient will provide higher performance than the normal DbClient. Unlike DbClient has own event loop, it shares the event loop with network IO threads and the main thread of the web application, which makes the internal implementation of FastDbClient available in a lock-free mode and more efficient. @@ -10,7 +10,7 @@ FastDbClient must be created automatically by the framework with the configurati The sub-option `is_fast` of the db_client option in the configuration file indicates if the client is a FastDbClient.Or user can create a FastDbClient by calling the app.createDbClient() method with the last parameter set to true. -The framework creates a separate FastDbClient for each IO's event loop and the main event loop, and each FastDbClient manages several database connections internally. The number of event loop of IO is controlled by the framework's "threads_num" option, which is generally set to the number of CPU cores of the host. The number of the DB connections per event loop is the value of the DB client "connection_number" option. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). Therefore, the total number of DB connections held by FastDbClient is `(threads_num+1) * connection_number`. +The framework creates a separate FastDbClient for each IO's event loop and the main event loop, and each FastDbClient manages several database connections internally. The number of event loop of IO is controlled by the framework's "threads_num" option, which is generally set to the number of CPU cores of the host. The number of the DB connections per event loop is the value of the DB client "connection_number" option. Please refer to [Configuration File](/ENG//ENG/ENG-10-Configuration-File#db_clients). Therefore, the total number of DB connections held by FastDbClient is `(threads_num+1) * connection_number`. The interface to get a FastDbClient is similar to the normal DbClient, as follows: @@ -30,4 +30,4 @@ The use of FastDbClient is almost identical to that of the normal DbClient, exce - Synchronous transaction creation interfaces are likely to block (when all connections are busy), so FastDbClient's synchronous transaction creation interface returns null pointers directly. If you want to use transactions on FastDbClient, please use the asynchronous transaction creation interface. - After using the FastDbClient to create an Orm Mapper object, you should also use only asynchronous non-blocking interfaces of the mapper object. -# Next: [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) +# Next: [Automatic batch mode](/ENG//ENG/ENG-08-5-Database-auto_batch) diff --git a/ENG/ENG-08-5-Database-auto_batch.md b/ENG/ENG-08-5-Database-auto_batch.md index 8060ccf..9405996 100644 --- a/ENG/ENG-08-5-Database-auto_batch.md +++ b/ENG/ENG-08-5-Database-auto_batch.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-08-5-数据库-自动批处理) +##### Other languages: [简体中文](/CHN//CHN/CHN-08-5-数据库-自动批处理) The automatic batch mode is only valid for the client library of postgresql 14+ version, and will be ignored in other cases. Before talking about automatic batch processing, let's understand the pipeline mode first. @@ -33,4 +33,4 @@ Therefore, automatic batch mode is helpful to improve performance, but it is not When using the newPgClient interface to create a client, set the third parameter to true to enable automatic batch mode; When using a configuration file to create a client, set the auto_batch option to true to enable automatic batch mode for the client; -# Next: [Request References](/ENG/ENG-09-0-References-request) +# Next: [Request References](/ENG//ENG/ENG-09-0-References-request) diff --git a/ENG/ENG-09-0-References-request.md b/ENG/ENG-09-0-References-request.md index ee473d7..7896981 100644 --- a/ENG/ENG-09-0-References-request.md +++ b/ENG/ENG-09-0-References-request.md @@ -87,7 +87,7 @@ The HttpRequest type pointer commonly named `req` in the examples in this docume path() #### Summary: - Function that returns the request path. Useful if you use an ADD_METHOD_VIA_REGEX or other type of dynamic URL in the [controller](/ENG/ENG-04-2-Controller-HttpController). + Function that returns the request path. Useful if you use an ADD_METHOD_VIA_REGEX or other type of dynamic URL in the [controller](/ENG//ENG/ENG-04-2-Controller-HttpController). #### Inputs: None. @@ -265,6 +265,6 @@ void mycontroller::postfile(const HttpRequestPtr &req, std::function //create model classes in model_path - #### View creation - The `dg_ctl create view` command is used to generate source files from csp files, see the [View](/ENG/ENG-07-View) section. In general, this command does not need to be used directly. It is better practice to configure the cmake file to executed this command automatically. The command example is as follows, assuming the csp file is `UsersList.csp`. + The `dg_ctl create view` command is used to generate source files from csp files, see the [View](/ENG//ENG/ENG-07-View) section. In general, this command does not need to be used directly. It is better practice to configure the cmake file to executed this command automatically. The command example is as follows, assuming the csp file is `UsersList.csp`. ```shell dg_ctl create view UsersList.csp @@ -95,7 +95,7 @@ drogon_ctl create model //create model classes in model_path - #### Filter creation - The `dg_ctl create filter` command is used to help the user create the source files for filters, see the [Middleware and Filter](/ENG/ENG-06-Middleware-and-Filter) section. + The `dg_ctl create filter` command is used to help the user create the source files for filters, see the [Middleware and Filter](/ENG//ENG/ENG-06-Middleware-and-Filter) section. ```shell dg_ctl create filter LoginFilter @@ -151,7 +151,7 @@ drogon_ctl create model //create model classes in model_path #include "models/User.h" ``` - Note that the models directory name is included to distinguish between multiple data sources in the same project. See [ORM](/ENG/ENG-08-3-Database-ORM). + Note that the models directory name is included to distinguish between multiple data sources in the same project. See [ORM](/ENG//ENG/ENG-08-3-Database-ORM). ### Stress Testing @@ -169,4 +169,4 @@ dg_ctl press -n1000000 -t4 -c1000 -q http://localhost:8080/ dg_ctl press -n 1000000 -t 4 -c 1000 https://www.domain.com/path/to/be/tested ``` -# Next: [Controller Introduction](/ENG/ENG-05-0-Controller-Introduction) +# Next: [Controller Introduction](/ENG//ENG/ENG-05-0-Controller-Introduction) diff --git a/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md b/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md index 5653e7b..2a6c81c 100644 --- a/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md +++ b/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-12-AOP面向切面编程) +##### Other languages: [简体中文](/CHN//CHN/CHN-12-AOP面向切面编程) AOP(Aspect Oriented Programming) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns(Quoted from Wikipedia). @@ -30,4 +30,4 @@ The following figure shows the location of the above four joinpoints in the HTTP ![](images/AOP.png) -# 13 [Benchmarks](/ENG/ENG-13-Benchmarks) +# 13 [Benchmarks](/ENG//ENG/ENG-13-Benchmarks) diff --git a/ENG/ENG-14-Benchmarks.md b/ENG/ENG-14-Benchmarks.md index 63522ee..0ed07a0 100644 --- a/ENG/ENG-14-Benchmarks.md +++ b/ENG/ENG-14-Benchmarks.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-13-性能测试) +##### Other languages: [简体中文](/CHN//CHN/CHN-13-性能测试) As a C++ Http application framework, performance should be one of the focus of attention. This section introduces Drogon's simple tests and achievements; @@ -47,4 +47,4 @@ The image below is a screenshot of a test: ![Test Result](images/benchmark.png) -# 14 [Causal profiling with coz](/ENG/ENG-14-Coz) +# 14 [Causal profiling with coz](/ENG//ENG/ENG-14-Coz) diff --git a/ENG/ENG-15-Coz.md b/ENG/ENG-15-Coz.md index dc47b1c..6c162af 100644 --- a/ENG/ENG-15-Coz.md +++ b/ENG/ENG-15-Coz.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-14-Coz分析) +##### Other languages: [简体中文](/CHN//CHN/CHN-14-Coz分析) ## Causal profiling with coz @@ -23,4 +23,4 @@ For more information checkout: * [Git repo](https://github.com/plasma-umass/coz) * [Coz whitepaper](https://arxiv.org/pdf/1608.03676v1.pdf) -# 15 [Brotli compression](/ENG/ENG-15-Brotli) +# 15 [Brotli compression](/ENG//ENG/ENG-15-Brotli) diff --git a/ENG/ENG-16-Brotli.md b/ENG/ENG-16-Brotli.md index d4b100c..4053684 100644 --- a/ENG/ENG-16-Brotli.md +++ b/ENG/ENG-16-Brotli.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-15-Brotli压缩) +##### Other languages: [简体中文](/CHN//CHN/CHN-15-Brotli压缩) ## Brotli Info @@ -13,4 +13,4 @@ if you want to dynamically compress with brotli you'll have to set `use_brotli` Users who don't intend to use brotli static, might want to get rid of brotli extra 'sibling check' by setting `br_static` to `false` in `config.json`. -# 16 [Coroutines](/ENG/ENG-16-Coroutines) +# 16 [Coroutines](/ENG//ENG/ENG-16-Coroutines) diff --git a/ENG/ENG-17-Coroutines.md b/ENG/ENG-17-Coroutines.md index 1e068e4..135dbd7 100644 --- a/ENG/ENG-17-Coroutines.md +++ b/ENG/ENG-17-Coroutines.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-16-协程) +##### Other languages: [简体中文](/CHN//CHN/CHN-16-协程) Drogon supports [C++ coroutines][1] starting from version 1.4. They provide a way to flatten the control flow of asynchronous calls, i.e. escaping the callback hell. With it, asynchronous programming becomes as easy as synchronous programming. @@ -166,4 +166,4 @@ There are some common pitfalls you may encounter when using coroutines. [1]: https://en.cppreference.com/w/cpp/language/coroutines -# 17 [Redis](/ENG/ENG-17-Redis) +# 17 [Redis](/ENG//ENG/ENG-17-Redis) diff --git a/ENG/ENG-18-Redis.md b/ENG/ENG-18-Redis.md index a9b54f2..266f2b0 100644 --- a/ENG/ENG-18-Redis.md +++ b/ENG/ENG-18-Redis.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-17-Redis) +##### Other languages: [简体中文](/CHN//CHN/CHN-17-Redis) Drogon supports Redis, a very fast, in-memory data store. Which could be used as a database cache or a message broker. Like everything in Drogon, Redis connections are asynchronous. Which ensures Drogon running with very high concurrency even under heavy load. @@ -102,7 +102,7 @@ redisClient->newTransactionAsync([](const RedisTransactionPtr &transPtr) { ### Coroutines -Redis clients support coroutines. One should use the GCC 11 or a newer compiler and use `cmake -DCMAKE_CXX_FLAGS="-std=c++20"` to enable it. See the (coroutine)[/ENG/ENG-16-Coroutines] section for more information. +Redis clients support coroutines. One should use the GCC 11 or a newer compiler and use `cmake -DCMAKE_CXX_FLAGS="-std=c++20"` to enable it. See the (coroutine)[/ENG//ENG/ENG-16-Coroutines] section for more information. ```c++ try @@ -118,4 +118,4 @@ catch(const std::exception& e) } ``` -# 18 [Testing Framework](/ENG/ENG-18-Testing-Framework) +# 18 [Testing Framework](/ENG//ENG/ENG-18-Testing-Framework) diff --git a/ENG/ENG-19-Testing-Framework.md b/ENG/ENG-19-Testing-Framework.md index ab7212d..209df62 100644 --- a/ENG/ENG-19-Testing-Framework.md +++ b/ENG/ENG-19-Testing-Framework.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-18-测试框架) +##### Other languages: [简体中文](/CHN//CHN/CHN-18-测试框架) DrogonTest is a minimal testing framework built into drogon to enable easy asynchronous testing as well as synchronous ones. It is used for Drogon's own unittests and integration tests. But could also be used for testing applications built with Drogon. The syntax of DrogonTest is inspired by both [GTest](https://github.com/google/googletest) and [Catch2](https://github.com/catchorg/Catch2). diff --git a/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md b/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md index f89e05d..a56f565 100644 --- a/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md +++ b/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-FAQ-1-线程模型.md) +##### Other languages: [简体中文](/CHN//CHN/CHN-FAQ-1-线程模型.md) # Understanding Drogon's threading model diff --git a/ENG/ENG-FAQ.md b/ENG/ENG-FAQ.md index e5ee413..0e55278 100644 --- a/ENG/ENG-FAQ.md +++ b/ENG/ENG-FAQ.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN/CHN-FAQ) +##### Other languages: [简体中文](/CHN//CHN/CHN-FAQ) # FAQ @@ -6,4 +6,4 @@ This is a list of commonly asked questions and the answers, with some extended e ## What's drogon's threading model and best practices? -Drogon runs on a thread pool where the HTTP server threads as well as DB threads are created when `app().run()` is called. It is a sequential task based system. Thus it is recommended to always use the asynchronous APIs or coroutines when possible. See [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) for detail. +Drogon runs on a thread pool where the HTTP server threads as well as DB threads are created when `app().run()` is called. It is a sequential task based system. Thus it is recommended to always use the asynchronous APIs or coroutines when possible. See [Understanding drogon's threading model](/ENG//ENG/ENG-FAQ-1-Understanding-drogon-threading-model) for detail. diff --git a/ENG/Home.md b/ENG/Home.md index f0aee89..b25c5cc 100644 --- a/ENG/Home.md +++ b/ENG/Home.md @@ -1,80 +1,80 @@ [English](Home) | [简体中文](Home.zh-CN) -### [Welcome to the drogon wiki!](/ENG/ENG-01-Overview) -* [Overview](/ENG/ENG-01-Overview) -* [Install drogon](/ENG/ENG-02-Installation) - * [System Requirements](/ENG/ENG-02-Installation#System-Requirements) - * [Library Dependencies](/ENG/ENG-02-Installation#Library-Dependencies) - * [System Preparation Examples](/ENG/ENG-02-Installation#System-Preparation-Examples) - * [Ubuntu](/ENG/ENG-02-Installation#Ubuntu-1804) - * [CentOS](/ENG/ENG-02-Installation#CentOS-75) - * [MacOS](/ENG/ENG-02-Installation#MacOS-122) - * [Windows](/ENG/ENG-02-Installation#Windows) - * [Database Environment](/ENG/ENG-02-Installation#Database-Environment) - * [PostgreSQL](/ENG/ENG-02-Installation#PostgreSQL) - * [MySQL](/ENG/ENG-02-Installation#MySQL) - * [SQLite3](/ENG/ENG-02-Installation#SQLite3) - * [Redis](/ENG/ENG-02-Installation#Redis) - * [Drogon Installation](/ENG/ENG-02-Installation#Drogon-Installation) - * [Install by source in Linux](/ENG/ENG-02-Installation#Install-by-source-in-Linux) - * [Install by source in Windows](/ENG/ENG-02-Installation#Install-by-source-in-Windows) - * [Install by vcpkg in Windows](/ENG/ENG-02-Installation#Install-by-vcpkg-in-Windows) - * [Use Docker Image](/ENG/ENG-02-Installation#Use-Docker-Image) - * [Use Nix Package](/ENG/ENG-02-Installation#Use-Nix-Package) - * [Use CPM.cmake](/CHN/CHN-02-安装#Use-CPM.cmake) - * [Include drogon source code locally](/ENG/ENG-02-Installation#Include-drogon-source-code-locally) -* [Quick Start](/ENG/ENG-03-Quick-Start) - * [Static Site](/ENG/ENG-03-Quick-Start#Static-Site) - * [Dynamic Site](/ENG/ENG-03-Quick-Start#Dynamic-Site) -* [Controller](/ENG/ENG-04-0-Controller-Introduction) - * [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) - * [HttpController](/ENG/ENG-04-2-Controller-HttpController) - * [Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Path-Mapping) - * [Parameter Mapping](/ENG/ENG-04-2-Controller-HttpController#Parameter-Mapping) - * [Multiple Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Multiple-Path-Mapping) - * [Regular Expressions Mapping](/ENG/ENG-04-2-Controller-HttpController#Regular-Expressions-Mapping) - * [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) - * [Path Mapping](/ENG/ENG-04-3-Controller-WebSocketController#Path-Mapping) - * [Interface](/ENG/ENG-04-3-Controller-WebSocketController#Interface) -* [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) - * [Build-in Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Built-in-Middleware/Filter) - * [Custom Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Custom-Middleware/Filter) -* [View](/ENG/ENG-06-View) - * [Drogon's CSP](/ENG/ENG-06-View#Drogon's-CSP) - * [Automated processing of csp files](/ENG/ENG-06-View#Automated-processing-of-csp-files) - * [Dynamic compilation and loading of views](/ENG/ENG-06-View#Dynamic-compilation-and-loading-of-views) -* [Session](/ENG/ENG-07-Session) -* [Database](/ENG/ENG-08-0-Database-General) - * [DbClient](/ENG/ENG-08-1-Database-DbClient) - * [Execution Interface](/ENG/ENG-08-1-Database-DbClient#Execution-Interface) - * [execSqlAsync](/ENG/ENG-08-1-Database-DbClient#execSqlAsync) - * [execSqlAsyncFuture](/ENG/ENG-08-1-Database-DbClient#execSqlAsyncFuture) - * [execSqlSync](/ENG/ENG-08-1-Database-DbClient#execSqlSync) - * [operator<<](/ENG/ENG-08-1-Database-DbClient#operator<<) - * [Transaction](/ENG/ENG-08-2-Database-Transaction) - * [ORM](/ENG/ENG-08-3-Database-ORM) - * [Model Class Interface](/ENG/ENG-08-3-Database-ORM#Model-Class-Interface) - * [Mapper Class Template](/ENG/ENG-08-3-Database-ORM#Mapper-Class-Template) - * [Criteria](/CHN/CHN-08-3-Database-ORM#Criteria) - * [Mapper's Chain Interface](/CHN/CHN-08-3-Database-ORM#Mapper's-Chain-Interface) - * [Convert](/CHN/CHN-08-3-Database-ORM#Convert) - * [Relationships](/CHN/CHN-08-3-Database-ORM#Relationships) - * [has one](/CHN/CHN-08-3-Database-ORM#has-one) - * [has many](/CHN/CHN-08-3-Database-ORM#has-many) - * [many to many](/CHN/CHN-08-3-Database-ORM#many-to-many) - * [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) - * [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) -* [Plugins](/ENG/ENG-09-Plugins) -* [Configuration File](/ENG/ENG-10-Configuration-File) -* [drogon_ctl Command](/ENG/ENG-11-drogon_ctl-Command) -* [AOP](/ENG/ENG-12-AOP-Aspect-Oriented-Programming) -* [Benchmarks](/ENG/ENG-13-Benchmarks) -* [Coz profiling](/ENG/ENG-14-Coz) -* [Brotli info](/ENG/ENG-15-Brotli) -* [Coroutines](/ENG/ENG-16-Coroutines) -* [Redis](/ENG/ENG-17-Redis) -* [Testing Framework](/ENG/ENG-18-Testing-Framework) -* [FAQ](/ENG/ENG-FAQ) - * [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) +### [Welcome to the drogon wiki!](/ENG//ENG/ENG-01-Overview) +* [Overview](/ENG//ENG/ENG-01-Overview) +* [Install drogon](/ENG//ENG/ENG-02-Installation) + * [System Requirements](/ENG//ENG/ENG-02-Installation#System-Requirements) + * [Library Dependencies](/ENG//ENG/ENG-02-Installation#Library-Dependencies) + * [System Preparation Examples](/ENG//ENG/ENG-02-Installation#System-Preparation-Examples) + * [Ubuntu](/ENG//ENG/ENG-02-Installation#Ubuntu-1804) + * [CentOS](/ENG//ENG/ENG-02-Installation#CentOS-75) + * [MacOS](/ENG//ENG/ENG-02-Installation#MacOS-122) + * [Windows](/ENG//ENG/ENG-02-Installation#Windows) + * [Database Environment](/ENG//ENG/ENG-02-Installation#Database-Environment) + * [PostgreSQL](/ENG//ENG/ENG-02-Installation#PostgreSQL) + * [MySQL](/ENG//ENG/ENG-02-Installation#MySQL) + * [SQLite3](/ENG//ENG/ENG-02-Installation#SQLite3) + * [Redis](/ENG//ENG/ENG-02-Installation#Redis) + * [Drogon Installation](/ENG//ENG/ENG-02-Installation#Drogon-Installation) + * [Install by source in Linux](/ENG//ENG/ENG-02-Installation#Install-by-source-in-Linux) + * [Install by source in Windows](/ENG//ENG/ENG-02-Installation#Install-by-source-in-Windows) + * [Install by vcpkg in Windows](/ENG//ENG/ENG-02-Installation#Install-by-vcpkg-in-Windows) + * [Use Docker Image](/ENG//ENG/ENG-02-Installation#Use-Docker-Image) + * [Use Nix Package](/ENG//ENG/ENG-02-Installation#Use-Nix-Package) + * [Use CPM.cmake](/CHN//CHN/CHN-02-安装#Use-CPM.cmake) + * [Include drogon source code locally](/ENG//ENG/ENG-02-Installation#Include-drogon-source-code-locally) +* [Quick Start](/ENG//ENG/ENG-03-Quick-Start) + * [Static Site](/ENG//ENG/ENG-03-Quick-Start#Static-Site) + * [Dynamic Site](/ENG//ENG/ENG-03-Quick-Start#Dynamic-Site) +* [Controller](/ENG//ENG/ENG-04-0-Controller-Introduction) + * [HttpSimpleController](/ENG//ENG/ENG-04-1-Controller-HttpSimpleController) + * [HttpController](/ENG//ENG/ENG-04-2-Controller-HttpController) + * [Path Mapping](/ENG//ENG/ENG-04-2-Controller-HttpController#Path-Mapping) + * [Parameter Mapping](/ENG//ENG/ENG-04-2-Controller-HttpController#Parameter-Mapping) + * [Multiple Path Mapping](/ENG//ENG/ENG-04-2-Controller-HttpController#Multiple-Path-Mapping) + * [Regular Expressions Mapping](/ENG//ENG/ENG-04-2-Controller-HttpController#Regular-Expressions-Mapping) + * [WebSocketController](/ENG//ENG/ENG-04-3-Controller-WebSocketController) + * [Path Mapping](/ENG//ENG/ENG-04-3-Controller-WebSocketController#Path-Mapping) + * [Interface](/ENG//ENG/ENG-04-3-Controller-WebSocketController#Interface) +* [Middleware and Filter](/ENG//ENG/ENG-05-Middleware-and-Filter) + * [Build-in Middleware/Filter](/ENG//ENG/ENG-05-Middleware-and-Filter#Built-in-Middleware/Filter) + * [Custom Middleware/Filter](/ENG//ENG/ENG-05-Middleware-and-Filter#Custom-Middleware/Filter) +* [View](/ENG//ENG/ENG-06-View) + * [Drogon's CSP](/ENG//ENG/ENG-06-View#Drogon's-CSP) + * [Automated processing of csp files](/ENG//ENG/ENG-06-View#Automated-processing-of-csp-files) + * [Dynamic compilation and loading of views](/ENG//ENG/ENG-06-View#Dynamic-compilation-and-loading-of-views) +* [Session](/ENG//ENG/ENG-07-Session) +* [Database](/ENG//ENG/ENG-08-0-Database-General) + * [DbClient](/ENG//ENG/ENG-08-1-Database-DbClient) + * [Execution Interface](/ENG//ENG/ENG-08-1-Database-DbClient#Execution-Interface) + * [execSqlAsync](/ENG//ENG/ENG-08-1-Database-DbClient#execSqlAsync) + * [execSqlAsyncFuture](/ENG//ENG/ENG-08-1-Database-DbClient#execSqlAsyncFuture) + * [execSqlSync](/ENG//ENG/ENG-08-1-Database-DbClient#execSqlSync) + * [operator<<](/ENG//ENG/ENG-08-1-Database-DbClient#operator<<) + * [Transaction](/ENG//ENG/ENG-08-2-Database-Transaction) + * [ORM](/ENG//ENG/ENG-08-3-Database-ORM) + * [Model Class Interface](/ENG//ENG/ENG-08-3-Database-ORM#Model-Class-Interface) + * [Mapper Class Template](/ENG//ENG/ENG-08-3-Database-ORM#Mapper-Class-Template) + * [Criteria](/CHN//CHN/CHN-08-3-Database-ORM#Criteria) + * [Mapper's Chain Interface](/CHN//CHN/CHN-08-3-Database-ORM#Mapper's-Chain-Interface) + * [Convert](/CHN//CHN/CHN-08-3-Database-ORM#Convert) + * [Relationships](/CHN//CHN/CHN-08-3-Database-ORM#Relationships) + * [has one](/CHN//CHN/CHN-08-3-Database-ORM#has-one) + * [has many](/CHN//CHN/CHN-08-3-Database-ORM#has-many) + * [many to many](/CHN//CHN/CHN-08-3-Database-ORM#many-to-many) + * [FastDbClient](/ENG//ENG/ENG-08-4-Database-FastDbClient) + * [Automatic batch mode](/ENG//ENG/ENG-08-5-Database-auto_batch) +* [Plugins](/ENG//ENG/ENG-09-Plugins) +* [Configuration File](/ENG//ENG/ENG-10-Configuration-File) +* [drogon_ctl Command](/ENG//ENG/ENG-11-drogon_ctl-Command) +* [AOP](/ENG//ENG/ENG-12-AOP-Aspect-Oriented-Programming) +* [Benchmarks](/ENG//ENG/ENG-13-Benchmarks) +* [Coz profiling](/ENG//ENG/ENG-14-Coz) +* [Brotli info](/ENG//ENG/ENG-15-Brotli) +* [Coroutines](/ENG//ENG/ENG-16-Coroutines) +* [Redis](/ENG//ENG/ENG-17-Redis) +* [Testing Framework](/ENG//ENG/ENG-18-Testing-Framework) +* [FAQ](/ENG//ENG/ENG-FAQ) + * [Understanding drogon's threading model](/ENG//ENG/ENG-FAQ-1-Understanding-drogon-threading-model) ### To contribute to the wiki, please visit the [drogon-docs](https://github.com/drogonframework/drogon-docs) repository. diff --git a/_Sidebar.md b/_Sidebar.md index 44382bf..59665dd 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -2,159 +2,159 @@ ### Tutorial -* [Overview](ENG-01-Overview) -* [Install drogon](ENG-02-Installation) - * [System Requirements](ENG-02-Installation#System-Requirements) - * [Library Dependencies](ENG-02-Installation#Library-Dependencies) - * [System Preparation Examples](ENG-02-Installation#System-Preparation-Examples) - * [Ubuntu](ENG-02-Installation#Ubuntu-1804) - * [CentOS](ENG-02-Installation#CentOS-75) - * [MacOS](ENG-02-Installation#MacOS-122) - * [Windows](ENG-02-Installation#Windows) - * [Database Environment](ENG-02-Installation#Database-Environment) - * [PostgreSQL](ENG-02-Installation#PostgreSQL) - * [MySQL](ENG-02-Installation#MySQL) - * [SQLite3](ENG-02-Installation#SQLite3) - * [Redis](ENG-02-Installation#Redis) - * [Drogon Installation](ENG-02-Installation#Drogon-Installation) - * [Install by source in Linux](ENG-02-Installation#Install-by-source-in-Linux) - * [Install by source in Windows](ENG-02-Installation#Install-by-source-in-Windows) - * [Install by vcpkg in Windows](ENG-02-Installation#Install-by-vcpkg-in-Windows) - * [Use Docker Image](ENG-02-Installation#Use-Docker-Image) - * [Use Nix Package](ENG-02-Installation#Use-Nix-Package) - * [Use CPM.cmake](ENG-02-Installation#Use-CPM.cmake) - * [Include drogon source code locally](ENG-02-Installation#Include-drogon-source-code-locally) -* [Quick Start](ENG-03-Quick-Start) - * [Static Site](ENG-03-Quick-Start#Static-Site) - * [Dynamic Site](ENG-03-Quick-Start#Dynamic-Site) -* [Controller](ENG-04-0-Controller-Introduction) - * [HttpSimpleController](ENG-04-1-Controller-HttpSimpleController) - * [HttpController](ENG-04-2-Controller-HttpController) - * [Path Mapping](ENG-04-2-Controller-HttpController#Path-Mapping) - * [Parameter Mapping](ENG-04-2-Controller-HttpController#Parameter-Mapping) - * [Multiple Path Mapping](ENG-04-2-Controller-HttpController#Multiple-Path-Mapping) - * [Regular Expressions Mapping](ENG-04-2-Controller-HttpController#Regular-Expressions-Mapping) - * [WebSocketController](ENG-04-3-Controller-WebSocketController) - * [Path Mapping](ENG-04-3-Controller-WebSocketController#Path-Mapping) - * [Interface](ENG-04-3-Controller-WebSocketController#Interface) -* [Middleware and Filter](ENG-05-Middleware-and-Filter) - * [Build-in Middleware/Filter](ENG-05-Middleware-and-Filter#Built-in-Middleware/Filter) - * [Custom Middleware/Filter](ENG-05-Middleware-and-Filter#Custom-Middleware/Filter) -* [View](ENG-06-View) - * [Drogon's CSP](ENG-06-View#Drogon's-CSP) - * [Automated processing of csp files](ENG-06-View#Automated-processing-of-csp-files) - * [Dynamic compilation and loading of views](ENG-06-View#Dynamic-compilation-and-loading-of-views) -* [Session](ENG-07-Session) -* [Database](ENG-08-0-Database-General) - * [DbClient](ENG-08-1-Database-DbClient) - * [Execution Interface](ENG-08-1-Database-DbClient#Execution-Interface) - * [execSqlAsync](ENG-08-1-Database-DbClient#execSqlAsync) - * [execSqlAsyncFuture](ENG-08-1-Database-DbClient#execSqlAsyncFuture) - * [execSqlSync](ENG-08-1-Database-DbClient#execSqlSync) - * [operator<<](ENG-08-1-Database-DbClient#operator<<) - * [Transaction](ENG-08-2-Database-Transaction) - * [ORM](ENG-08-3-Database-ORM) - * [Model Class Interface](ENG-08-3-Database-ORM#Model-Class-Interface) - * [Mapper Class Template](ENG-08-3-Database-ORM#Mapper-Class-Template) - * [Criteria](ENG-08-3-Database-ORM#Criteria) - * [Mapper's Chain Interface](ENG-08-3-Database-ORM#Mapper's-Chain-Interface) - * [Convert](ENG-08-3-Database-ORM#Convert) - * [Relationships](ENG-08-3-Database-ORM#Relationships) - * [has one](ENG-08-3-Database-ORM#has-one) - * [has many](ENG-08-3-Database-ORM#has-many) - * [many to many](ENG-08-3-Database-ORM#many-to-many) - * [FastDbClient](ENG-08-4-Database-FastDbClient) - * [Automatic batch mode](ENG-08-5-Database-auto_batch) -* [References](ENG-09-0-References-request) - * [Request References](ENG-09-0-References-request) - * [File Handler](ENG-09-1-File-Handler) -* [Plugins](ENG-10-Plugins) -* [Configuration File](ENG-11-Configuration-File) -* [drogon_ctl Command](ENG-12-drogon_ctl-Command) -* [AOP](ENG-13-AOP-Aspect-Oriented-Programming) -* [Benchmarks](ENG-14-Benchmarks) -* [Coz profiling](ENG-15-Coz) -* [Brotli info](ENG-16-Brotli) -* [Coroutines](ENG-17-Coroutines) -* [Redis](ENG-18-Redis) -* [Testing Framework](ENG-19-Testing-Framework) -* [FAQ](ENG-FAQ) - * [Understanding drogon's threading model](ENG-FAQ-1-Understanding-drogon-threading-model) +* [Overview](/ENG/ENG-01-Overview) +* [Install drogon](/ENG/ENG-02-Installation) + * [System Requirements](/ENG/ENG-02-Installation#System-Requirements) + * [Library Dependencies](/ENG/ENG-02-Installation#Library-Dependencies) + * [System Preparation Examples](/ENG/ENG-02-Installation#System-Preparation-Examples) + * [Ubuntu](/ENG/ENG-02-Installation#Ubuntu-1804) + * [CentOS](/ENG/ENG-02-Installation#CentOS-75) + * [MacOS](/ENG/ENG-02-Installation#MacOS-122) + * [Windows](/ENG/ENG-02-Installation#Windows) + * [Database Environment](/ENG/ENG-02-Installation#Database-Environment) + * [PostgreSQL](/ENG/ENG-02-Installation#PostgreSQL) + * [MySQL](/ENG/ENG-02-Installation#MySQL) + * [SQLite3](/ENG/ENG-02-Installation#SQLite3) + * [Redis](/ENG/ENG-02-Installation#Redis) + * [Drogon Installation](/ENG/ENG-02-Installation#Drogon-Installation) + * [Install by source in Linux](/ENG/ENG-02-Installation#Install-by-source-in-Linux) + * [Install by source in Windows](/ENG/ENG-02-Installation#Install-by-source-in-Windows) + * [Install by vcpkg in Windows](/ENG/ENG-02-Installation#Install-by-vcpkg-in-Windows) + * [Use Docker Image](/ENG/ENG-02-Installation#Use-Docker-Image) + * [Use Nix Package](/ENG/ENG-02-Installation#Use-Nix-Package) + * [Use CPM.cmake](/ENG/ENG-02-Installation#Use-CPM.cmake) + * [Include drogon source code locally](/ENG/ENG-02-Installation#Include-drogon-source-code-locally) +* [Quick Start](/ENG/ENG-03-Quick-Start) + * [Static Site](/ENG/ENG-03-Quick-Start#Static-Site) + * [Dynamic Site](/ENG/ENG-03-Quick-Start#Dynamic-Site) +* [Controller](/ENG/ENG-04-0-Controller-Introduction) + * [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) + * [HttpController](/ENG/ENG-04-2-Controller-HttpController) + * [Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Path-Mapping) + * [Parameter Mapping](/ENG/ENG-04-2-Controller-HttpController#Parameter-Mapping) + * [Multiple Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Multiple-Path-Mapping) + * [Regular Expressions Mapping](/ENG/ENG-04-2-Controller-HttpController#Regular-Expressions-Mapping) + * [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) + * [Path Mapping](/ENG/ENG-04-3-Controller-WebSocketController#Path-Mapping) + * [Interface](/ENG/ENG-04-3-Controller-WebSocketController#Interface) +* [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) + * [Build-in Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Built-in-Middleware/Filter) + * [Custom Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Custom-Middleware/Filter) +* [View](/ENG/ENG-06-View) + * [Drogon's CSP](/ENG/ENG-06-View#Drogon's-CSP) + * [Automated processing of csp files](/ENG/ENG-06-View#Automated-processing-of-csp-files) + * [Dynamic compilation and loading of views](/ENG/ENG-06-View#Dynamic-compilation-and-loading-of-views) +* [Session](/ENG/ENG-07-Session) +* [Database](/ENG/ENG-08-0-Database-General) + * [DbClient](/ENG/ENG-08-1-Database-DbClient) + * [Execution Interface](/ENG/ENG-08-1-Database-DbClient#Execution-Interface) + * [execSqlAsync](/ENG/ENG-08-1-Database-DbClient#execSqlAsync) + * [execSqlAsyncFuture](/ENG/ENG-08-1-Database-DbClient#execSqlAsyncFuture) + * [execSqlSync](/ENG/ENG-08-1-Database-DbClient#execSqlSync) + * [operator<<](/ENG/ENG-08-1-Database-DbClient#operator<<) + * [Transaction](/ENG/ENG-08-2-Database-Transaction) + * [ORM](/ENG/ENG-08-3-Database-ORM) + * [Model Class Interface](/ENG/ENG-08-3-Database-ORM#Model-Class-Interface) + * [Mapper Class Template](/ENG/ENG-08-3-Database-ORM#Mapper-Class-Template) + * [Criteria](/ENG/ENG-08-3-Database-ORM#Criteria) + * [Mapper's Chain Interface](/ENG/ENG-08-3-Database-ORM#Mapper's-Chain-Interface) + * [Convert](/ENG/ENG-08-3-Database-ORM#Convert) + * [Relationships](/ENG/ENG-08-3-Database-ORM#Relationships) + * [has one](/ENG/ENG-08-3-Database-ORM#has-one) + * [has many](/ENG/ENG-08-3-Database-ORM#has-many) + * [many to many](/ENG/ENG-08-3-Database-ORM#many-to-many) + * [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) + * [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) +* [References](/ENG/ENG-09-0-References-request) + * [Request References](/ENG/ENG-09-0-References-request) + * [File Handler](/ENG/ENG-09-1-File-Handler) +* [Plugins](/ENG/ENG-10-Plugins) +* [Configuration File](/ENG/ENG-11-Configuration-File) +* [drogon_ctl Command](/ENG/ENG-12-drogon_ctl-Command) +* [AOP](/ENG/ENG-13-AOP-Aspect-Oriented-Programming) +* [Benchmarks](/ENG/ENG-14-Benchmarks) +* [Coz profiling](/ENG/ENG-15-Coz) +* [Brotli info](/ENG/ENG-16-Brotli) +* [Coroutines](/ENG/ENG-17-Coroutines) +* [Redis](/ENG/ENG-18-Redis) +* [Testing Framework](/ENG/ENG-19-Testing-Framework) +* [FAQ](/ENG/ENG-FAQ) + * [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) ## 中文文档 ### 教程 -* [概述](CHN-01-概述) -* [安装 drogon](CHN-02-安装) - * [系统要求](CHN-02-安装#系统要求) - * [依赖库](CHN-02-安装#依赖库) - * [系统准备范例](CHN-02-安装#系统准备范例) - * [Ubuntu](CHN-02-安装#Ubuntu-1804) - * [CentOS](CHN-02-安装#CentOS-75) - * [MacOS](CHN-02-安装#MacOS-122) - * [Windows](CHN-02-安装#Windows) - * [数据库环境](CHN-02-安装#数据库环境) - * [PostgreSQL](CHN-02-安装#PostgreSQL) - * [MySQL](CHN-02-安装#MySQL) - * [SQLite3](CHN-02-安装#SQLite3) - * [Redis](CHN-02-安装#Redis) - * [安装 drogon](CHN-02-安装#安装drogon) - * [Linux源码安装](CHN-02-安装#Linux源码安装) - * [Windows源码安装](CHN-02-安装#Windows源码安装) - * [Windows vcpkg安装](CHN-02-安装#Windows-vcpkg安装) - * [使用docker镜像](CHN-02-安装#使用docker镜像) - * [使用Nix包](CHN-02-安装#使用Nix包) - * [使用CPM.cmake](CHN-02-安装#使用CPM.cmake) - * [直接包含drogon源码](CHN-02-安装#直接包含drogon源码) -* [快速开始](CHN-03-快速开始) - * [静态网站](CHN-03-快速开始#静态网站) - * [动态网站](CHN-03-快速开始#动态网站) -* [控制器](CHN-04-0-控制器-简介) - * [HttpSimpleController](CHN-04-1-控制器-HttpSimpleController) - * [HttpController](CHN-04-2-控制器-HttpController) - * [路径映射](CHN-04-2-控制器-HttpController#路径映射) - * [参数映射](CHN-04-2-控制器-HttpController#参数映射) - * [多路径映射](CHN-04-2-控制器-HttpController#多路径映射) - * [正则表达式映射](CHN-04-2-控制器-HttpController#正则表达式映射) - * [WebSocketController](CHN-04-3-控制器-WebSocketController) - * [路径映射](CHN-04-3-控制器-WebSocketController#路径映射) - * [接口](CHN-04-3-控制器-WebSocketController#接口) -* [中间件和过滤器](CHN-05-中间件和过滤器) - * [内置中间件/过滤器](CHN-05-中间件和过滤器#内置中间件/过滤器) - * [自定义中间件/过滤器](CHN-05-中间件和过滤器#自定义中间件/过滤器) -* [视图](CHN-06-视图) - * [Drogon的csp](CHN-06-视图#Drogon的csp) - * [csp文件的自动化处理](CHN-06-视图#csp文件的自动化处理) - * [视图的动态编译和加载](CHN-06-视图#视图的动态编译和加载) -* [会话](CHN-07-会话) -* [数据库](CHN-08-0-数据库-概述) - * [DbClient](CHN-08-1-数据库-DbClient) - * [执行接口](CHN-08-1-数据库-DbClient#执行接口) - * [execSqlAsync](CHN-08-1-数据库-DbClient#execSqlAsync) - * [execSqlAsyncFuture](CHN-08-1-数据库-DbClient#execSqlAsyncFuture) - * [execSqlSync](CHN-08-1-数据库-DbClient#execSqlSync) - * [operator<<](CHN-08-1-数据库-DbClient#operator<<) - * [事务](CHN-08-2-数据库-事务) - * [ORM](CHN-08-3-数据库-ORM) - * [Model类的接口](CHN-08-3-数据库-ORM#Model类的接口) - * [Mapper类模板](CHN-08-3-数据库-ORM#Mapper类模板) - * [条件对象](CHN-08-3-数据库-ORM#条件对象) - * [Mapper 的链式接口](CHN-08-3-数据库-ORM#Mapper的链式接口) - * [转换](CHN-08-3-数据库-ORM#转换) - * [关系](CHN-08-3-数据库-ORM#关系) - * [has one](CHN-08-3-数据库-ORM#has-one) - * [has many](CHN-08-3-数据库-ORM#has-many) - * [many to many](CHN-08-3-数据库-ORM#many-to-many) - * [FastDbClient](CHN-08-4-数据库-FastDbClient) - * [自动批处理模式](CHN-08-5-数据库-自动批处理) -* [插件](CHN-09-插件) -* [配置文件](CHN-10-配置文件) -* [drogon_ctl命令](CHN-11-drogon_ctl命令) -* [AOP面向切面编程](CHN-12-AOP面向切面编程) -* [性能测试](CHN-13-性能测试) -* [协程](CHN-16-协程) -* [Redis](CHN-17-Redis) -* [测试框架](CHN-18-测试框架) -* [FAQ](CHN-FAQ) - * [drogon的线程模型](CHN-FAQ-1-线程模型) +* [概述](/CHN/CHN-01-概述) +* [安装 drogon](/CHN/CHN-02-安装) + * [系统要求](/CHN/CHN-02-安装#系统要求) + * [依赖库](/CHN/CHN-02-安装#依赖库) + * [系统准备范例](/CHN/CHN-02-安装#系统准备范例) + * [Ubuntu](/CHN/CHN-02-安装#Ubuntu-1804) + * [CentOS](/CHN/CHN-02-安装#CentOS-75) + * [MacOS](/CHN/CHN-02-安装#MacOS-122) + * [Windows](/CHN/CHN-02-安装#Windows) + * [数据库环境](/CHN/CHN-02-安装#数据库环境) + * [PostgreSQL](/CHN/CHN-02-安装#PostgreSQL) + * [MySQL](/CHN/CHN-02-安装#MySQL) + * [SQLite3](/CHN/CHN-02-安装#SQLite3) + * [Redis](/CHN/CHN-02-安装#Redis) + * [安装 drogon](/CHN/CHN-02-安装#安装drogon) + * [Linux源码安装](/CHN/CHN-02-安装#Linux源码安装) + * [Windows源码安装](/CHN/CHN-02-安装#Windows源码安装) + * [Windows vcpkg安装](/CHN/CHN-02-安装#Windows-vcpkg安装) + * [使用docker镜像](/CHN/CHN-02-安装#使用docker镜像) + * [使用Nix包](/CHN/CHN-02-安装#使用Nix包) + * [使用CPM.cmake](/CHN/CHN-02-安装#使用CPM.cmake) + * [直接包含drogon源码](/CHN/CHN-02-安装#直接包含drogon源码) +* [快速开始](/CHN/CHN-03-快速开始) + * [静态网站](/CHN/CHN-03-快速开始#静态网站) + * [动态网站](/CHN/CHN-03-快速开始#动态网站) +* [控制器](/CHN/CHN-04-0-控制器-简介) + * [HttpSimpleController](/CHN/CHN-04-1-控制器-HttpSimpleController) + * [HttpController](/CHN/CHN-04-2-控制器-HttpController) + * [路径映射](/CHN/CHN-04-2-控制器-HttpController#路径映射) + * [参数映射](/CHN/CHN-04-2-控制器-HttpController#参数映射) + * [多路径映射](/CHN/CHN-04-2-控制器-HttpController#多路径映射) + * [正则表达式映射](/CHN/CHN-04-2-控制器-HttpController#正则表达式映射) + * [WebSocketController](/CHN/CHN-04-3-控制器-WebSocketController) + * [路径映射](/CHN/CHN-04-3-控制器-WebSocketController#路径映射) + * [接口](/CHN/CHN-04-3-控制器-WebSocketController#接口) +* [中间件和过滤器](/CHN/CHN-05-中间件和过滤器) + * [内置中间件/过滤器](/CHN/CHN-05-中间件和过滤器#内置中间件/过滤器) + * [自定义中间件/过滤器](/CHN/CHN-05-中间件和过滤器#自定义中间件/过滤器) +* [视图](/CHN/CHN-06-视图) + * [Drogon的csp](/CHN/CHN-06-视图#Drogon的csp) + * [csp文件的自动化处理](/CHN/CHN-06-视图#csp文件的自动化处理) + * [视图的动态编译和加载](/CHN/CHN-06-视图#视图的动态编译和加载) +* [会话](/CHN/CHN-07-会话) +* [数据库](/CHN/CHN-08-0-数据库-概述) + * [DbClient](/CHN/CHN-08-1-数据库-DbClient) + * [执行接口](/CHN/CHN-08-1-数据库-DbClient#执行接口) + * [execSqlAsync](/CHN/CHN-08-1-数据库-DbClient#execSqlAsync) + * [execSqlAsyncFuture](/CHN/CHN-08-1-数据库-DbClient#execSqlAsyncFuture) + * [execSqlSync](/CHN/CHN-08-1-数据库-DbClient#execSqlSync) + * [operator<<](/CHN/CHN-08-1-数据库-DbClient#operator<<) + * [事务](/CHN/CHN-08-2-数据库-事务) + * [ORM](/CHN/CHN-08-3-数据库-ORM) + * [Model类的接口](/CHN/CHN-08-3-数据库-ORM#Model类的接口) + * [Mapper类模板](/CHN/CHN-08-3-数据库-ORM#Mapper类模板) + * [条件对象](/CHN/CHN-08-3-数据库-ORM#条件对象) + * [Mapper 的链式接口](/CHN/CHN-08-3-数据库-ORM#Mapper的链式接口) + * [转换](/CHN/CHN-08-3-数据库-ORM#转换) + * [关系](/CHN/CHN-08-3-数据库-ORM#关系) + * [has one](/CHN/CHN-08-3-数据库-ORM#has-one) + * [has many](/CHN/CHN-08-3-数据库-ORM#has-many) + * [many to many](/CHN/CHN-08-3-数据库-ORM#many-to-many) + * [FastDbClient](/CHN/CHN-08-4-数据库-FastDbClient) + * [自动批处理模式](/CHN/CHN-08-5-数据库-自动批处理) +* [插件](/CHN/CHN-09-插件) +* [配置文件](/CHN/CHN-10-配置文件) +* [drogon_ctl命令](/CHN/CHN-11-drogon_ctl命令) +* [AOP面向切面编程](/CHN/CHN-12-AOP面向切面编程) +* [性能测试](/CHN/CHN-13-性能测试) +* [协程](/CHN/CHN-16-协程) +* [Redis](/CHN/CHN-17-Redis) +* [测试框架](/CHN/CHN-18-测试框架) +* [FAQ](/CHN/CHN-FAQ) + * [drogon的线程模型](/CHN/CHN-FAQ-1-线程模型) diff --git a/index.html b/index.html index 72dcda0..4a42958 100644 --- a/index.html +++ b/index.html @@ -25,7 +25,7 @@ themeColor: '#1373b3', loadSidebar: '_Sidebar.md', loadFooter: '_Footer.md', - homepage: '/ENG-01-Overview.md', + homepage: '//ENG/ENG-01-Overview.md', name: 'Drogon docs', alias: { // Prevent unnecesary nested _Sidebar.md to be used (optional) '/.*/_Sidebar.md': '/_Sidebar.md' From 557192c59e37288b16a0d6dd1d9116101f5a08e1 Mon Sep 17 00:00:00 2001 From: Chuck <32836622+chuckn408@users.noreply.github.com> Date: Fri, 28 Jun 2024 13:27:51 -0700 Subject: [PATCH 4/7] Prefer C++20 > 17 for standardization --- "CHN/CHN-01-\346\246\202\350\277\260.md" | 2 +- "CHN/CHN-02-\345\256\211\350\243\205.md" | 2 +- ENG/ENG-01-Overview.md | 2 +- ENG/ENG-02-Installation.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git "a/CHN/CHN-01-\346\246\202\350\277\260.md" "b/CHN/CHN-01-\346\246\202\350\277\260.md" index 870232c..63b9654 100644 --- "a/CHN/CHN-01-\346\246\202\350\277\260.md" +++ "b/CHN/CHN-01-\346\246\202\350\277\260.md" @@ -1,6 +1,6 @@ [English](/ENG/ENG-01-Overview) | [简体中文](/CHN/CHN-01-概述) -**Drogon**是一个基于C++17/20的Http应用框架,使用Drogon可以方便的使用C++构建各种类型的Web应用服务端程序。 +**Drogon**是一个基于C++20的Http应用框架,使用Drogon可以方便的使用C++构建各种类型的Web应用服务端程序。 Drogon的主要应用平台是Linux,也支持Mac OS、FreeBSD和Windows。 diff --git "a/CHN/CHN-02-\345\256\211\350\243\205.md" "b/CHN/CHN-02-\345\256\211\350\243\205.md" index ba04788..4f92ffa 100644 --- "a/CHN/CHN-02-\345\256\211\350\243\205.md" +++ "b/CHN/CHN-02-\345\256\211\350\243\205.md" @@ -18,7 +18,7 @@ * libuuid,生成uuid的c库; * zlib,用于支持压缩传输; * 可选 - * boost,版本**不低于1.61**,只在C++编译器不支持c++17或STL库不完整支持`std::filesystem`时才需要安装; + * boost,版本**不低于1.61**,只在C++编译器不支持c++20或STL库不完整支持`std::filesystem`时才需要安装; * OpenSSL,安装后drogon将支持HTTPS,否则drogon只支持HTTP; * c-ares, 安装后drogon对DNS的支持会具有更好的性能; * libbrotli,安装后drogon的HTTP响应会支持brotli压缩; diff --git a/ENG/ENG-01-Overview.md b/ENG/ENG-01-Overview.md index 9c920c1..76f250f 100644 --- a/ENG/ENG-01-Overview.md +++ b/ENG/ENG-01-Overview.md @@ -1,6 +1,6 @@ ##### Other languages: [简体中文](/CHN//CHN//CHN/CHN-01-概述) -**Drogon** is a C++17/20-based HTTP application framework. Drogon can be used to easily build various types of web application server programs using C++. +**Drogon** is a C++20-based HTTP application framework. Drogon can be used to easily build various types of web application server programs using C++. **Drogon** is the name of a dragon in the American TV series "Game of Thrones" that I really like. diff --git a/ENG/ENG-02-Installation.md b/ENG/ENG-02-Installation.md index 96afd0a..2ec09a9 100644 --- a/ENG/ENG-02-Installation.md +++ b/ENG/ENG-02-Installation.md @@ -291,7 +291,7 @@ Assuming that the above environment and library dependencies are all ready, the mkdir build cd build conan profile detect --force - conan install .. -s compiler="msvc" -s compiler.version=193 -s compiler.cppstd=17 -s build_type=Debug --output-folder . --build=missing + conan install .. -s compiler="msvc" -s compiler.version=193 -s compiler.cppstd=20 -s build_type=Debug --output-folder . --build=missing ``` > Modify `conanfile.txt` to change the version of dependencies. From 1e599aaa6a9b3495ee380916b2850382fc104be1 Mon Sep 17 00:00:00 2001 From: Chuck <32836622+chuckn408@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:43:20 -0700 Subject: [PATCH 5/7] fix broken links --- ENG/ENG-01-Overview.md | 4 +- ENG/ENG-02-Installation.md | 4 +- ENG/ENG-03-Quick-Start.md | 12 +- ENG/ENG-04-0-Controller-Introduction.md | 6 +- ...NG-04-1-Controller-HttpSimpleController.md | 6 +- ENG/ENG-04-2-Controller-HttpController.md | 4 +- ...ENG-04-3-Controller-WebSocketController.md | 6 +- ENG/ENG-05-Middleware-and-Filter.md | 8 +- ENG/ENG-06-View.md | 4 +- ENG/ENG-07-Session.md | 4 +- ENG/ENG-08-0-Database-General.md | 12 +- ENG/ENG-08-1-Database-DbClient.md | 6 +- ENG/ENG-08-2-Database-Transaction.md | 4 +- ENG/ENG-08-3-Database-ORM.md | 8 +- ENG/ENG-08-4-Database-FastDbClient.md | 6 +- ENG/ENG-08-5-Database-auto_batch.md | 4 +- ENG/ENG-09-0-References-request.md | 6 +- ENG/ENG-09-1-File-Handler.md | 2 +- ENG/ENG-10-Plugins.md | 4 +- ENG/ENG-11-Configuration-File.md | 12 +- ENG/ENG-12-drogon_ctl-Command.md | 10 +- ENG/ENG-13-AOP-Aspect-Oriented-Programming.md | 4 +- ENG/ENG-14-Benchmarks.md | 4 +- ENG/ENG-15-Coz.md | 4 +- ENG/ENG-16-Brotli.md | 4 +- ENG/ENG-17-Coroutines.md | 4 +- ENG/ENG-18-Redis.md | 6 +- ENG/ENG-19-Testing-Framework.md | 2 +- ...-1-Understanding-drogon-threading-model.md | 2 +- ENG/ENG-FAQ.md | 4 +- ENG/Home.md | 152 +++++++++--------- 31 files changed, 159 insertions(+), 159 deletions(-) diff --git a/ENG/ENG-01-Overview.md b/ENG/ENG-01-Overview.md index 9c920c1..32ed056 100644 --- a/ENG/ENG-01-Overview.md +++ b/ENG/ENG-01-Overview.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN//CHN/CHN-01-概述) +##### Other languages: [简体中文](/CHN/CHN-01-概述) **Drogon** is a C++17/20-based HTTP application framework. Drogon can be used to easily build various types of web application server programs using C++. @@ -31,4 +31,4 @@ Its main features are as follows: * Support plugins which can be installed by the configuration file at load time; * Support AOP with build-in joinpoints. -# Next: [Install drogon](/ENG//ENG//ENG/ENG-02-Installation) +# Next: [Install drogon](/ENG/ENG-02-Installation) diff --git a/ENG/ENG-02-Installation.md b/ENG/ENG-02-Installation.md index 96afd0a..09c725c 100644 --- a/ENG/ENG-02-Installation.md +++ b/ENG/ENG-02-Installation.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN//CHN/CHN-02-安装) +##### Other languages: [简体中文](/CHN/CHN-02-安装) This section takes Ubuntu 18.04, CentOS 7.5, MacOS 12.2 as an example to introduce the installation process. Other systems are similar; @@ -481,4 +481,4 @@ Assuming that the above environment and library dependencies are all ready, the target_link_libraries(${PROJECT_NAME} PRIVATE drogon) ``` -# Next: [Quick Start](/ENG//ENG//ENG/ENG-03-Quick-Start) +# Next: [Quick Start](/ENG/ENG-03-Quick-Start) diff --git a/ENG/ENG-03-Quick-Start.md b/ENG/ENG-03-Quick-Start.md index 9cd9ca2..fd04677 100644 --- a/ENG/ENG-03-Quick-Start.md +++ b/ENG/ENG-03-Quick-Start.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN//CHN/CHN-03-快速开始) +##### Other languages: [简体中文](/CHN/CHN-03-快速开始) ## Static Site @@ -22,7 +22,7 @@ There are several useful folders in the project directory already: └── views The folder where view csp files are stored ``` -Users can put various files (such as controllers, filters, views, etc.) into the corresponding folders. For more convenience and less error, we strongly recommend that users create their own web application projects using the `drogon_ctl` command. See [drogon_ctl](/ENG//ENG/ENG-11-drogon_ctl-Command) for more details. +Users can put various files (such as controllers, filters, views, etc.) into the corresponding folders. For more convenience and less error, we strongly recommend that users create their own web application projects using the `drogon_ctl` command. See [drogon_ctl](/ENG/ENG-11-drogon_ctl-Command) for more details. Let's look at the main.cc file: @@ -55,12 +55,12 @@ Now, we simply add one static file index.html to the Http root path: echo '

Hello Drogon!

' >>index.html ``` -The default root path is `"./"`, but could also be modified by config.json. See [Configuration File](/ENG//ENG/ENG-10-Configuration-File) for more details. Then you can visit this page by URL `"http://localhost"` or`"http://localhost/index.html"` (or the IP of the server where your wepapp is running). +The default root path is `"./"`, but could also be modified by config.json. See [Configuration File](/ENG/ENG-10-Configuration-File) for more details. Then you can visit this page by URL `"http://localhost"` or`"http://localhost/index.html"` (or the IP of the server where your wepapp is running). -![Hello Drogon!](images/hellodrogon.png) +![Hello Drogon!](/images/hellodrogon.png) If the server cannot find the the page you have requested, it returns a 404 page: -![404 page](images/notfound.png) +![404 page](/images/notfound.png) > **Note: Make sure your server firewall has allowed the 80 port. Otherwise, you won't see these pages.(Another way is to change your port from 80 to 1024(or above) in case you get the error message below):** @@ -194,4 +194,4 @@ We see that adding a controller to an application is very simple. You only need > **Note: Drogon has no restrictions on the location of the controller source files. You could also save them in "./" (the project root directory), or you could even define a new directory in `CMakeLists.txt`. It is recommended to use the controllers directory for the convenience of management.** -# Next: [drogon_ctl Command](/ENG//ENG/ENG-04-0-Controller-Introduction) +# Next: [drogon_ctl Command](/ENG/ENG-04-0-Controller-Introduction) diff --git a/ENG/ENG-04-0-Controller-Introduction.md b/ENG/ENG-04-0-Controller-Introduction.md index 01462fc..ca7fd0a 100644 --- a/ENG/ENG-04-0-Controller-Introduction.md +++ b/ENG/ENG-04-0-Controller-Introduction.md @@ -1,6 +1,6 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-04-控制器-简介) +##### Other languages: [简体中文](/CHN/CHN-04-控制器-简介) -The controller is very important in web application development. This is where we will define our URLs, which HTTP methods are allowed, which [filters](/ENG//ENG/ENG-06-Middleware-and-Filter) will be applied and how requests will be processed and responded to. The drogon framework has helped us to handle the network transmission, Http protocol analysis and so on. We only need to pay attention to the logic of the controller; each controller object can have one or more processing functions (generally called handlers), and the interface of the function is generally defined as follows: +The controller is very important in web application development. This is where we will define our URLs, which HTTP methods are allowed, which [filters](/ENG/ENG-06-Middleware-and-Filter) will be applied and how requests will be processed and responded to. The drogon framework has helped us to handle the network transmission, Http protocol analysis and so on. We only need to pay attention to the logic of the controller; each controller object can have one or more processing functions (generally called handlers), and the interface of the function is generally defined as follows: ```c++ Void handlerName(const HttpRequestPtr &req, @@ -33,4 +33,4 @@ public: A controller registered to a drogon framework will have at most only one instance and will not be destroyed during the entire application run, so users can declare and use member variables in the controller class. Note that when the handler of the controller is called, it is in a multi-threaded environment (when the number of IO threads of the framework is configured to be greater than 1), if you need to access non-temporary variables, please do the concurrent protection work. -# Next: [HttpSimpleController](/ENG//ENG/ENG-04-1-Controller-HttpSimpleController) +# Next: [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) diff --git a/ENG/ENG-04-1-Controller-HttpSimpleController.md b/ENG/ENG-04-1-Controller-HttpSimpleController.md index f206169..db4afa9 100644 --- a/ENG/ENG-04-1-Controller-HttpSimpleController.md +++ b/ENG/ENG-04-1-Controller-HttpSimpleController.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-04-1-控制器-HttpSimpleController) +##### Other languages: [简体中文](/CHN/CHN-04-1-控制器-HttpSimpleController) You could use the `drogon_ctl` command line tool to quickly generate custom controller class source files based on `HttpSimpleController`. The command format is as bellow: @@ -47,7 +47,7 @@ Each HttpSimpleController class can only define one Http request handler, and it The route (or called mapping) from the URL path to the handler is done by a macro. You could add multipath mappings with the `PATH_ADD` macro. All `PATH_ADD` statements should be set between the `PATH_LIST_BEGIN` and `PATH_LIST_END` macro statements. -The first parameter is the path to be mapped, and parameters beyond the path are constraints on this path. Currently, two types of constraints are supported. One is the `HttpMethod` enum Type, which means the Http method allowed. The other type is the name of the `HttpFilter` class. One can configure any number of these two types of constraints, and there are no order requirements for them. For Filter, please refer to [Middleware and Filter](/ENG//ENG/ENG-05-Middleware-and-Filter). +The first parameter is the path to be mapped, and parameters beyond the path are constraints on this path. Currently, two types of constraints are supported. One is the `HttpMethod` enum Type, which means the Http method allowed. The other type is the name of the `HttpFilter` class. One can configure any number of these two types of constraints, and there are no order requirements for them. For Filter, please refer to [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter). Users can register the same Simple Controller to multiple paths, or register multiple Simple Controllers on the same path (using different HTTP methods). @@ -64,4 +64,4 @@ You could define an HttpResponse class variable, and then use the callback() to > **The mapping from the above path to the handler is done at compile time. In fact, the drogon framework also provides an interface for runtime completion mapping. The runtime mapping allows the user to map or modify the mapping through configuration files or other user interfaces without recompiling this program (For performance reasons, it is forbidden to add any controller mapping after running the app().run() method).** -# Next: [HttpController](/ENG//ENG/ENG-04-2-Controller-HttpController) +# Next: [HttpController](/ENG/ENG-04-2-Controller-HttpController) diff --git a/ENG/ENG-04-2-Controller-HttpController.md b/ENG/ENG-04-2-Controller-HttpController.md index 65f96b6..c5b9177 100644 --- a/ENG/ENG-04-2-Controller-HttpController.md +++ b/ENG/ENG-04-2-Controller-HttpController.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-04-2-控制器-HttpController) +##### Other languages: [简体中文](/CHN/CHN-04-2-控制器-HttpController) ### Generation @@ -279,4 +279,4 @@ Each `HttpController` class can define many Http request handlers. Since the num > **It should be noted that when using regular expressions, you should pay attention to matching conflicts (multiple different handlers are matched). When conflicts happen in the same controller, drogon will only execute the first handler (the one registered in the framework first). When conflicts happen between different controllers, it is uncertain which handler will be executed. Therefore, users need to avoid these conflicts.** -# Next: [WebSocketController](/ENG//ENG/ENG-04-3-Controller-WebSocketController) +# Next: [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) diff --git a/ENG/ENG-04-3-Controller-WebSocketController.md b/ENG/ENG-04-3-Controller-WebSocketController.md index ff86940..2d62efe 100644 --- a/ENG/ENG-04-3-Controller-WebSocketController.md +++ b/ENG/ENG-04-3-Controller-WebSocketController.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-04-3-控制器-WebSocketController) +##### Other languages: [简体中文](/CHN/CHN-04-3-控制器-WebSocketController) As the name implies, `WebSocketController` is used to process websocket logic. Websocket is a persistent HTTP-based connection scheme. At the beginning of the websocket, there is an HTTP format request and response exchange. After the websocket connection is established, all messages are transmitted on the websocket. The message is wrapped in a fixed format. There is no limit to the message content and the order in which messages are transmitted. @@ -100,7 +100,7 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr } ``` - First, in this example, the controller is registered to the `/echo` path via the `WS_PATH_ADD` macro. The usage of the `WS_PATH_ADD` macro is similar to the macros of other controllers introduced earlier. One can also register the path with several [Filters](/ENG//ENG/ENG-05-Middleware-and-Filter). Since websocket is handled separately in the framework, it can be repeated with the paths of the first two controllers(`HttpSimpleController` and `HttpApiController`) without affecting each other. + First, in this example, the controller is registered to the `/echo` path via the `WS_PATH_ADD` macro. The usage of the `WS_PATH_ADD` macro is similar to the macros of other controllers introduced earlier. One can also register the path with several [Filters](/ENG/ENG-05-Middleware-and-Filter). Since websocket is handled separately in the framework, it can be repeated with the paths of the first two controllers(`HttpSimpleController` and `HttpApiController`) without affecting each other. Secondly, in the implementation of the three virtual functions in this example, only the handleNewMessage has the substance, but simply sends the received message back to the client through the send interface.Compile this controller into the framework, you can see the effect, please test it yourself. @@ -150,4 +150,4 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr any *getMutableContext(); ``` -# Next: [Middleware and Filter](/ENG//ENG/ENG-05-Middleware-and-Filter) +# Next: [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) diff --git a/ENG/ENG-05-Middleware-and-Filter.md b/ENG/ENG-05-Middleware-and-Filter.md index 4173cd8..92b8d04 100644 --- a/ENG/ENG-05-Middleware-and-Filter.md +++ b/ENG/ENG-05-Middleware-and-Filter.md @@ -1,6 +1,6 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-05-中间件和过滤器) +##### Other languages: [简体中文](/CHN/CHN-05-中间件和过滤器) -In HttpController's [example](/ENG//ENG/ENG-04-2-Controller-HttpController), the getInfo method should check whether the user is logged in before returning the user's information. We can write this logic in the getInfo method, but obviously, checking the user's login membership is general logic which will be used by many interfaces, it should be extracted separately and configured before calling handler, which is what filters do. +In HttpController's [example](/ENG/ENG-04-2-Controller-HttpController), the getInfo method should check whether the user is logged in before returning the user's information. We can write this logic in the getInfo method, but obviously, checking the user's login membership is general logic which will be used by many interfaces, it should be extracted separately and configured before calling handler, which is what filters do. Drogon's middleware uses the onion model. After the framework completes URL path matching, it sequentially invokes the middleware registered for that path. Within each middleware, users can choose to intercept or pass through the request and add pre-processing and post-processing logic. @@ -71,7 +71,7 @@ Drogon contains the following common filters: }; ``` - You could create filter by the `drogon_ctl` command, see [drogon_ctl](/ENG//ENG/ENG-11-drogon_ctl-command#Filter-creation). + You could create filter by the `drogon_ctl` command, see [drogon_ctl](/ENG/ENG-11-drogon_ctl-command#Filter-creation). You need to override the doFilter virtual function of the parent class to implement the filter logic; @@ -100,4 +100,4 @@ Drogon contains the following common filters: > **Note: If the middleware/filter is defined in the namespace, you must write the namespace completely when you register it.** -# Next: [View](/ENG//ENG/ENG-06-View) +# Next: [View](/ENG/ENG-06-View) diff --git a/ENG/ENG-06-View.md b/ENG/ENG-06-View.md index da77524..628de19 100644 --- a/ENG/ENG-06-View.md +++ b/ENG/ENG-06-View.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-06-视图) +##### Other languages: [简体中文](/CHN/CHN-06-视图) ### Views Introduction @@ -151,4 +151,4 @@ Obviously, this function depends on the development environment. If both drogon > **Note: If a `symbol not found` error occurs while loading a dynamic view, please use the `cmake .. -DCMAKE_ENABLE_EXPORTS=on` to configure your project, or uncomment the last line (`set_property(TARGET ${PROJECT_NAME} PROPERTY ENABLE_EXPORTS ON)`) in your project's CMakeLists.txt, and then rebuild the project** -# Next: [Session](/ENG//ENG/ENG-07-Session) +# Next: [Session](/ENG/ENG-07-Session) diff --git a/ENG/ENG-07-Session.md b/ENG/ENG-07-Session.md index 89b0e58..8eee5ab 100644 --- a/ENG/ENG-07-Session.md +++ b/ENG/ENG-07-Session.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-07-会话) +##### Other languages: [简体中文](/CHN/CHN-07-会话) `Session` is an important concept of the web application. It is used to save the state of the client on the server. Generally, it cooperates with the browser's `cookie`, and drogon provides support for the session. Drogon **close** the session selection by default, you can also close or open it through the following interface: @@ -96,4 +96,4 @@ drogon::HttpAppFramework::instance().enableSession(1200); Recompile the entire project with CMake, run the target program webapp, and you can see the effect through the browser. -# Next: [Database](/ENG//ENG/ENG-08-0-Database-General) +# Next: [Database](/ENG/ENG-08-0-Database-General) diff --git a/ENG/ENG-08-0-Database-General.md b/ENG/ENG-08-0-Database-General.md index 924e3b2..928d278 100644 --- a/ENG/ENG-08-0-Database-General.md +++ b/ENG/ENG-08-0-Database-General.md @@ -1,8 +1,8 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-08-0-数据库-概述) +##### Other languages: [简体中文](/CHN/CHN-08-0-数据库-概述) ### General -**Drogon** has built-in database read/write engine. The operation of database connection is based on non-blocking I/O technology. Therefore, the application works in an efficient non-blocking asynchronous mode from the bottom to the upper layer, which ensures Drogon's high concurrency performance. Currently, Drogon supports PostgreSQL and MySQL databases. If you want to use a database, the development environment of the corresponding database must be installed first. Drogon will automatically detect the header files and library files of these libraries and compile the corresponding parts. For the preparation of the database development environment, see [Development Environment](/ENG//ENG/ENG-02-Installation#Database-Environment). +**Drogon** has built-in database read/write engine. The operation of database connection is based on non-blocking I/O technology. Therefore, the application works in an efficient non-blocking asynchronous mode from the bottom to the upper layer, which ensures Drogon's high concurrency performance. Currently, Drogon supports PostgreSQL and MySQL databases. If you want to use a database, the development environment of the corresponding database must be installed first. Drogon will automatically detect the header files and library files of these libraries and compile the corresponding parts. For the preparation of the database development environment, see [Development Environment](/ENG/ENG-02-Installation#Database-Environment). **Drogon** supports the sqlite3 database in order to support lightweight applications. The asynchronous interface is implemented through the thread pool, which is the same as the interfaces of the aforementioned databases. @@ -14,14 +14,14 @@ The basic class of Drogon's database is `DbClient` (this is an abstract class, t Usually, when an asynchronous interface is called, `DbClient` will randomly select one of the idle connections it manages to perform related query operations. When the result returns, `DbClient` will process the data and return it to the caller through the callback function object; Without an idle connection, the execution content will be cached. Once a connection has executed its own sql request, the pending command will be fetched from the cache to execute. -For details on `DbClient`, see [DbClient](/ENG//ENG/ENG-08-1-Database-DbClient). +For details on `DbClient`, see [DbClient](/ENG/ENG-08-1-Database-DbClient). ### Transaction -The transaction object can be generated by `DbClient` to support transaction operations. In addition to the extra `rollback()` interface, the transaction object is basically the same as `DbClient`. The transaction class is `Transaction`. For details of the `Transaction` class, see [Transaction](/ENG//ENG/ENG-08-2-Database-Transaction). +The transaction object can be generated by `DbClient` to support transaction operations. In addition to the extra `rollback()` interface, the transaction object is basically the same as `DbClient`. The transaction class is `Transaction`. For details of the `Transaction` class, see [Transaction](/ENG/ENG-08-2-Database-Transaction). ### ORM -Drogon also provides support for **ORM**. Users can use the drogon_ctl command to read the tables in the database and generate the corresponding model source code. Then, execute the database operations of these models through the `Mapper` class template. Mapper provides simple and convenient interfaces for standard database operations, allowing users to make the additions, deletions, and changes to the table without writing sql statements. For **ORM**, please refer to [ORM](/ENG//ENG/ENG-08-3-Database-ORM) +Drogon also provides support for **ORM**. Users can use the drogon_ctl command to read the tables in the database and generate the corresponding model source code. Then, execute the database operations of these models through the `Mapper` class template. Mapper provides simple and convenient interfaces for standard database operations, allowing users to make the additions, deletions, and changes to the table without writing sql statements. For **ORM**, please refer to [ORM](/ENG/ENG-08-3-Database-ORM) -# Next: [DbClient](/ENG//ENG/ENG-08-1-Database-DbClient) +# Next: [DbClient](/ENG/ENG-08-1-Database-DbClient) diff --git a/ENG/ENG-08-1-Database-DbClient.md b/ENG/ENG-08-1-Database-DbClient.md index ff68808..e0f2f98 100644 --- a/ENG/ENG-08-1-Database-DbClient.md +++ b/ENG/ENG-08-1-Database-DbClient.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-08-1-数据库-DbClient) +##### Other languages: [简体中文](/CHN/CHN-08-1-数据库-DbClient) ### DbClient Object Construction @@ -20,7 +20,7 @@ The object obtained by the above method, the user has to find a way to persist i - This will waste time creating connections and disconnections, increasing system latency; - The interface is also a non-blocking interface. That is to say, when the user gets the DbClient object, the connection managed by the it has not been established yet. The framework does not (intentionally) provide a callback interface for successful connection establishment. Do you still have to sleep before starting the query?? This is contrary to the original intention of the asynchronous framework. -Therefore, DbClient objects should be built at the beginning of the program and held and used throughout the life time. Obviously, this work can be done entirely by the framework. So the drogon framework provides the second build method, which is built by configuration file or the `createDbClient()` method. For the configuration method of the configuration file, see [db_clients](/ENG//ENG/ENG-10-Configuration-file#db_clients). +Therefore, DbClient objects should be built at the beginning of the program and held and used throughout the life time. Obviously, this work can be done entirely by the framework. So the drogon framework provides the second build method, which is built by configuration file or the `createDbClient()` method. For the configuration method of the configuration file, see [db_clients](/ENG/ENG-10-Configuration-file#db_clients). When needed, the DbClient smart pointer is obtained through the interface of the framework. The interface is as follows: @@ -253,4 +253,4 @@ Each DbClient object has one or multiple its own EventLoop threads controlling t Blocking interfaces of DbClient only block the caller thread, as long as the caller thread is not the EventLoop thread, it will not affect the normal operation of the EventLoop thread. When the callback function is called, the program inside the callback is run on the EventLoop thread. Therefore, do not perform any blocking operations within the callback, otherwise it will affect the concurrency performance of database read and write. Anyone familiar with non-blocking I/O programming should understand this constraint. -# Next: [Transaction](/ENG//ENG/ENG-08-2-Database-Transaction) +# Next: [Transaction](/ENG/ENG-08-2-Database-Transaction) diff --git a/ENG/ENG-08-2-Database-Transaction.md b/ENG/ENG-08-2-Database-Transaction.md index fa54aac..6112d6a 100644 --- a/ENG/ENG-08-2-Database-Transaction.md +++ b/ENG/ENG-08-2-Database-Transaction.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-08-2-数据库-事务) +##### Other languages: [简体中文](/CHN/CHN-08-2-数据库-事务) > **Transactions** are an important feature of relational databases, and Drogon provides transaction support with the `Transaction` class. @@ -83,4 +83,4 @@ For the simplest example, suppose there is a task table from which the user sele In this case, select for update is used to avoid concurrent modifications. The update statement is completed in the result callback of the select statement. The outermost braces are used to limit the scope of the transPtr so that it can be destroyed in time after the execution of sql to end the transaction. -# Next: [ORM](/ENG//ENG/ENG-08-3-Database-ORM) +# Next: [ORM](/ENG/ENG-08-3-Database-ORM) diff --git a/ENG/ENG-08-3-Database-ORM.md b/ENG/ENG-08-3-Database-ORM.md index 0add918..cd0e9d0 100644 --- a/ENG/ENG-08-3-Database-ORM.md +++ b/ENG/ENG-08-3-Database-ORM.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-08-3-数据库-ORM) +##### Other languages: [简体中文](/CHN/CHN-08-3-数据库-ORM) ### Model @@ -30,7 +30,7 @@ The last parameter is the path to store model classes. There must be a configura } ``` -The configured parameters are the same as the application's configuration file. Please refer to [Configuration File](/ENG//ENG/ENG-10-Configuration-File#db_clients). +The configured parameters are the same as the application's configuration file. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). The `tables` configuration option is unique to the model configuration. It is an array of strings. Each string represents the name of the table to be converted into a model class. If this option is empty, all tables will be used to generate model classes. @@ -99,7 +99,7 @@ template explicit Criteria(const CustomSql &sql, Arguments &&...args) ``` -The first argument is a `CustomSql` object of sql statements with `$?` placeholders, while the `CustomSql` class is just a wrapper of a std::string. The second indefinite argument is a parameter pack represents the bound parameter, which behaves just like the ones in [execSqlAsync](/ENG//ENG/ENG-08-1-Database-DbClient.md#execSqlAsync). +The first argument is a `CustomSql` object of sql statements with `$?` placeholders, while the `CustomSql` class is just a wrapper of a std::string. The second indefinite argument is a parameter pack represents the bound parameter, which behaves just like the ones in [execSqlAsync](/ENG/ENG-08-1-Database-DbClient.md#execSqlAsync). E.g: @@ -286,4 +286,4 @@ drogon_ctl can also generate restful-style controllers for each model (or table) It should be noted that the controller of each table is designed to be composed of a base class and a subclass. Among them, the base class and the table are closely related, and the subclass is used to implement special business logic or modify the interface format. The advantage of this design is that when the table structure changes, users can update only the base class without overwriting the subclass(by setting the `generate_base_only` option to `true`). -# Next: [FastDbClient](/ENG//ENG/ENG-08-4-Database-FastDbClient) +# Next: [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) diff --git a/ENG/ENG-08-4-Database-FastDbClient.md b/ENG/ENG-08-4-Database-FastDbClient.md index 07922ac..bc4d82a 100644 --- a/ENG/ENG-08-4-Database-FastDbClient.md +++ b/ENG/ENG-08-4-Database-FastDbClient.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-08-4-数据库-FastDbClient) +##### Other languages: [简体中文](/CHN/CHN-08-4-数据库-FastDbClient) As the name implies, FastDbClient will provide higher performance than the normal DbClient. Unlike DbClient has own event loop, it shares the event loop with network IO threads and the main thread of the web application, which makes the internal implementation of FastDbClient available in a lock-free mode and more efficient. @@ -10,7 +10,7 @@ FastDbClient must be created automatically by the framework with the configurati The sub-option `is_fast` of the db_client option in the configuration file indicates if the client is a FastDbClient.Or user can create a FastDbClient by calling the app.createDbClient() method with the last parameter set to true. -The framework creates a separate FastDbClient for each IO's event loop and the main event loop, and each FastDbClient manages several database connections internally. The number of event loop of IO is controlled by the framework's "threads_num" option, which is generally set to the number of CPU cores of the host. The number of the DB connections per event loop is the value of the DB client "connection_number" option. Please refer to [Configuration File](/ENG//ENG/ENG-10-Configuration-File#db_clients). Therefore, the total number of DB connections held by FastDbClient is `(threads_num+1) * connection_number`. +The framework creates a separate FastDbClient for each IO's event loop and the main event loop, and each FastDbClient manages several database connections internally. The number of event loop of IO is controlled by the framework's "threads_num" option, which is generally set to the number of CPU cores of the host. The number of the DB connections per event loop is the value of the DB client "connection_number" option. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). Therefore, the total number of DB connections held by FastDbClient is `(threads_num+1) * connection_number`. The interface to get a FastDbClient is similar to the normal DbClient, as follows: @@ -30,4 +30,4 @@ The use of FastDbClient is almost identical to that of the normal DbClient, exce - Synchronous transaction creation interfaces are likely to block (when all connections are busy), so FastDbClient's synchronous transaction creation interface returns null pointers directly. If you want to use transactions on FastDbClient, please use the asynchronous transaction creation interface. - After using the FastDbClient to create an Orm Mapper object, you should also use only asynchronous non-blocking interfaces of the mapper object. -# Next: [Automatic batch mode](/ENG//ENG/ENG-08-5-Database-auto_batch) +# Next: [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) diff --git a/ENG/ENG-08-5-Database-auto_batch.md b/ENG/ENG-08-5-Database-auto_batch.md index 9405996..8060ccf 100644 --- a/ENG/ENG-08-5-Database-auto_batch.md +++ b/ENG/ENG-08-5-Database-auto_batch.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-08-5-数据库-自动批处理) +##### Other languages: [简体中文](/CHN/CHN-08-5-数据库-自动批处理) The automatic batch mode is only valid for the client library of postgresql 14+ version, and will be ignored in other cases. Before talking about automatic batch processing, let's understand the pipeline mode first. @@ -33,4 +33,4 @@ Therefore, automatic batch mode is helpful to improve performance, but it is not When using the newPgClient interface to create a client, set the third parameter to true to enable automatic batch mode; When using a configuration file to create a client, set the auto_batch option to true to enable automatic batch mode for the client; -# Next: [Request References](/ENG//ENG/ENG-09-0-References-request) +# Next: [Request References](/ENG/ENG-09-0-References-request) diff --git a/ENG/ENG-09-0-References-request.md b/ENG/ENG-09-0-References-request.md index 7896981..ee473d7 100644 --- a/ENG/ENG-09-0-References-request.md +++ b/ENG/ENG-09-0-References-request.md @@ -87,7 +87,7 @@ The HttpRequest type pointer commonly named `req` in the examples in this docume path() #### Summary: - Function that returns the request path. Useful if you use an ADD_METHOD_VIA_REGEX or other type of dynamic URL in the [controller](/ENG//ENG/ENG-04-2-Controller-HttpController). + Function that returns the request path. Useful if you use an ADD_METHOD_VIA_REGEX or other type of dynamic URL in the [controller](/ENG/ENG-04-2-Controller-HttpController). #### Inputs: None. @@ -265,6 +265,6 @@ void mycontroller::postfile(const HttpRequestPtr &req, std::function //create model classes in model_path - #### View creation - The `dg_ctl create view` command is used to generate source files from csp files, see the [View](/ENG//ENG/ENG-07-View) section. In general, this command does not need to be used directly. It is better practice to configure the cmake file to executed this command automatically. The command example is as follows, assuming the csp file is `UsersList.csp`. + The `dg_ctl create view` command is used to generate source files from csp files, see the [View](/ENG/ENG-07-View) section. In general, this command does not need to be used directly. It is better practice to configure the cmake file to executed this command automatically. The command example is as follows, assuming the csp file is `UsersList.csp`. ```shell dg_ctl create view UsersList.csp @@ -95,7 +95,7 @@ drogon_ctl create model //create model classes in model_path - #### Filter creation - The `dg_ctl create filter` command is used to help the user create the source files for filters, see the [Middleware and Filter](/ENG//ENG/ENG-06-Middleware-and-Filter) section. + The `dg_ctl create filter` command is used to help the user create the source files for filters, see the [Middleware and Filter](/ENG/ENG-06-Middleware-and-Filter) section. ```shell dg_ctl create filter LoginFilter @@ -151,7 +151,7 @@ drogon_ctl create model //create model classes in model_path #include "models/User.h" ``` - Note that the models directory name is included to distinguish between multiple data sources in the same project. See [ORM](/ENG//ENG/ENG-08-3-Database-ORM). + Note that the models directory name is included to distinguish between multiple data sources in the same project. See [ORM](/ENG/ENG-08-3-Database-ORM). ### Stress Testing @@ -169,4 +169,4 @@ dg_ctl press -n1000000 -t4 -c1000 -q http://localhost:8080/ dg_ctl press -n 1000000 -t 4 -c 1000 https://www.domain.com/path/to/be/tested ``` -# Next: [Controller Introduction](/ENG//ENG/ENG-05-0-Controller-Introduction) +# Next: [Controller Introduction](/ENG/ENG-05-0-Controller-Introduction) diff --git a/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md b/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md index 2a6c81c..5653e7b 100644 --- a/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md +++ b/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-12-AOP面向切面编程) +##### Other languages: [简体中文](/CHN/CHN-12-AOP面向切面编程) AOP(Aspect Oriented Programming) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns(Quoted from Wikipedia). @@ -30,4 +30,4 @@ The following figure shows the location of the above four joinpoints in the HTTP ![](images/AOP.png) -# 13 [Benchmarks](/ENG//ENG/ENG-13-Benchmarks) +# 13 [Benchmarks](/ENG/ENG-13-Benchmarks) diff --git a/ENG/ENG-14-Benchmarks.md b/ENG/ENG-14-Benchmarks.md index 0ed07a0..63522ee 100644 --- a/ENG/ENG-14-Benchmarks.md +++ b/ENG/ENG-14-Benchmarks.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-13-性能测试) +##### Other languages: [简体中文](/CHN/CHN-13-性能测试) As a C++ Http application framework, performance should be one of the focus of attention. This section introduces Drogon's simple tests and achievements; @@ -47,4 +47,4 @@ The image below is a screenshot of a test: ![Test Result](images/benchmark.png) -# 14 [Causal profiling with coz](/ENG//ENG/ENG-14-Coz) +# 14 [Causal profiling with coz](/ENG/ENG-14-Coz) diff --git a/ENG/ENG-15-Coz.md b/ENG/ENG-15-Coz.md index 6c162af..dc47b1c 100644 --- a/ENG/ENG-15-Coz.md +++ b/ENG/ENG-15-Coz.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-14-Coz分析) +##### Other languages: [简体中文](/CHN/CHN-14-Coz分析) ## Causal profiling with coz @@ -23,4 +23,4 @@ For more information checkout: * [Git repo](https://github.com/plasma-umass/coz) * [Coz whitepaper](https://arxiv.org/pdf/1608.03676v1.pdf) -# 15 [Brotli compression](/ENG//ENG/ENG-15-Brotli) +# 15 [Brotli compression](/ENG/ENG-15-Brotli) diff --git a/ENG/ENG-16-Brotli.md b/ENG/ENG-16-Brotli.md index 4053684..d4b100c 100644 --- a/ENG/ENG-16-Brotli.md +++ b/ENG/ENG-16-Brotli.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-15-Brotli压缩) +##### Other languages: [简体中文](/CHN/CHN-15-Brotli压缩) ## Brotli Info @@ -13,4 +13,4 @@ if you want to dynamically compress with brotli you'll have to set `use_brotli` Users who don't intend to use brotli static, might want to get rid of brotli extra 'sibling check' by setting `br_static` to `false` in `config.json`. -# 16 [Coroutines](/ENG//ENG/ENG-16-Coroutines) +# 16 [Coroutines](/ENG/ENG-16-Coroutines) diff --git a/ENG/ENG-17-Coroutines.md b/ENG/ENG-17-Coroutines.md index 135dbd7..1e068e4 100644 --- a/ENG/ENG-17-Coroutines.md +++ b/ENG/ENG-17-Coroutines.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-16-协程) +##### Other languages: [简体中文](/CHN/CHN-16-协程) Drogon supports [C++ coroutines][1] starting from version 1.4. They provide a way to flatten the control flow of asynchronous calls, i.e. escaping the callback hell. With it, asynchronous programming becomes as easy as synchronous programming. @@ -166,4 +166,4 @@ There are some common pitfalls you may encounter when using coroutines. [1]: https://en.cppreference.com/w/cpp/language/coroutines -# 17 [Redis](/ENG//ENG/ENG-17-Redis) +# 17 [Redis](/ENG/ENG-17-Redis) diff --git a/ENG/ENG-18-Redis.md b/ENG/ENG-18-Redis.md index 266f2b0..a9b54f2 100644 --- a/ENG/ENG-18-Redis.md +++ b/ENG/ENG-18-Redis.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-17-Redis) +##### Other languages: [简体中文](/CHN/CHN-17-Redis) Drogon supports Redis, a very fast, in-memory data store. Which could be used as a database cache or a message broker. Like everything in Drogon, Redis connections are asynchronous. Which ensures Drogon running with very high concurrency even under heavy load. @@ -102,7 +102,7 @@ redisClient->newTransactionAsync([](const RedisTransactionPtr &transPtr) { ### Coroutines -Redis clients support coroutines. One should use the GCC 11 or a newer compiler and use `cmake -DCMAKE_CXX_FLAGS="-std=c++20"` to enable it. See the (coroutine)[/ENG//ENG/ENG-16-Coroutines] section for more information. +Redis clients support coroutines. One should use the GCC 11 or a newer compiler and use `cmake -DCMAKE_CXX_FLAGS="-std=c++20"` to enable it. See the (coroutine)[/ENG/ENG-16-Coroutines] section for more information. ```c++ try @@ -118,4 +118,4 @@ catch(const std::exception& e) } ``` -# 18 [Testing Framework](/ENG//ENG/ENG-18-Testing-Framework) +# 18 [Testing Framework](/ENG/ENG-18-Testing-Framework) diff --git a/ENG/ENG-19-Testing-Framework.md b/ENG/ENG-19-Testing-Framework.md index 209df62..ab7212d 100644 --- a/ENG/ENG-19-Testing-Framework.md +++ b/ENG/ENG-19-Testing-Framework.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-18-测试框架) +##### Other languages: [简体中文](/CHN/CHN-18-测试框架) DrogonTest is a minimal testing framework built into drogon to enable easy asynchronous testing as well as synchronous ones. It is used for Drogon's own unittests and integration tests. But could also be used for testing applications built with Drogon. The syntax of DrogonTest is inspired by both [GTest](https://github.com/google/googletest) and [Catch2](https://github.com/catchorg/Catch2). diff --git a/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md b/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md index a56f565..f89e05d 100644 --- a/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md +++ b/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-FAQ-1-线程模型.md) +##### Other languages: [简体中文](/CHN/CHN-FAQ-1-线程模型.md) # Understanding Drogon's threading model diff --git a/ENG/ENG-FAQ.md b/ENG/ENG-FAQ.md index 0e55278..e5ee413 100644 --- a/ENG/ENG-FAQ.md +++ b/ENG/ENG-FAQ.md @@ -1,4 +1,4 @@ -##### Other languages: [简体中文](/CHN//CHN/CHN-FAQ) +##### Other languages: [简体中文](/CHN/CHN-FAQ) # FAQ @@ -6,4 +6,4 @@ This is a list of commonly asked questions and the answers, with some extended e ## What's drogon's threading model and best practices? -Drogon runs on a thread pool where the HTTP server threads as well as DB threads are created when `app().run()` is called. It is a sequential task based system. Thus it is recommended to always use the asynchronous APIs or coroutines when possible. See [Understanding drogon's threading model](/ENG//ENG/ENG-FAQ-1-Understanding-drogon-threading-model) for detail. +Drogon runs on a thread pool where the HTTP server threads as well as DB threads are created when `app().run()` is called. It is a sequential task based system. Thus it is recommended to always use the asynchronous APIs or coroutines when possible. See [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) for detail. diff --git a/ENG/Home.md b/ENG/Home.md index b25c5cc..94585df 100644 --- a/ENG/Home.md +++ b/ENG/Home.md @@ -1,80 +1,80 @@ [English](Home) | [简体中文](Home.zh-CN) -### [Welcome to the drogon wiki!](/ENG//ENG/ENG-01-Overview) -* [Overview](/ENG//ENG/ENG-01-Overview) -* [Install drogon](/ENG//ENG/ENG-02-Installation) - * [System Requirements](/ENG//ENG/ENG-02-Installation#System-Requirements) - * [Library Dependencies](/ENG//ENG/ENG-02-Installation#Library-Dependencies) - * [System Preparation Examples](/ENG//ENG/ENG-02-Installation#System-Preparation-Examples) - * [Ubuntu](/ENG//ENG/ENG-02-Installation#Ubuntu-1804) - * [CentOS](/ENG//ENG/ENG-02-Installation#CentOS-75) - * [MacOS](/ENG//ENG/ENG-02-Installation#MacOS-122) - * [Windows](/ENG//ENG/ENG-02-Installation#Windows) - * [Database Environment](/ENG//ENG/ENG-02-Installation#Database-Environment) - * [PostgreSQL](/ENG//ENG/ENG-02-Installation#PostgreSQL) - * [MySQL](/ENG//ENG/ENG-02-Installation#MySQL) - * [SQLite3](/ENG//ENG/ENG-02-Installation#SQLite3) - * [Redis](/ENG//ENG/ENG-02-Installation#Redis) - * [Drogon Installation](/ENG//ENG/ENG-02-Installation#Drogon-Installation) - * [Install by source in Linux](/ENG//ENG/ENG-02-Installation#Install-by-source-in-Linux) - * [Install by source in Windows](/ENG//ENG/ENG-02-Installation#Install-by-source-in-Windows) - * [Install by vcpkg in Windows](/ENG//ENG/ENG-02-Installation#Install-by-vcpkg-in-Windows) - * [Use Docker Image](/ENG//ENG/ENG-02-Installation#Use-Docker-Image) - * [Use Nix Package](/ENG//ENG/ENG-02-Installation#Use-Nix-Package) - * [Use CPM.cmake](/CHN//CHN/CHN-02-安装#Use-CPM.cmake) - * [Include drogon source code locally](/ENG//ENG/ENG-02-Installation#Include-drogon-source-code-locally) -* [Quick Start](/ENG//ENG/ENG-03-Quick-Start) - * [Static Site](/ENG//ENG/ENG-03-Quick-Start#Static-Site) - * [Dynamic Site](/ENG//ENG/ENG-03-Quick-Start#Dynamic-Site) -* [Controller](/ENG//ENG/ENG-04-0-Controller-Introduction) - * [HttpSimpleController](/ENG//ENG/ENG-04-1-Controller-HttpSimpleController) - * [HttpController](/ENG//ENG/ENG-04-2-Controller-HttpController) - * [Path Mapping](/ENG//ENG/ENG-04-2-Controller-HttpController#Path-Mapping) - * [Parameter Mapping](/ENG//ENG/ENG-04-2-Controller-HttpController#Parameter-Mapping) - * [Multiple Path Mapping](/ENG//ENG/ENG-04-2-Controller-HttpController#Multiple-Path-Mapping) - * [Regular Expressions Mapping](/ENG//ENG/ENG-04-2-Controller-HttpController#Regular-Expressions-Mapping) - * [WebSocketController](/ENG//ENG/ENG-04-3-Controller-WebSocketController) - * [Path Mapping](/ENG//ENG/ENG-04-3-Controller-WebSocketController#Path-Mapping) - * [Interface](/ENG//ENG/ENG-04-3-Controller-WebSocketController#Interface) -* [Middleware and Filter](/ENG//ENG/ENG-05-Middleware-and-Filter) - * [Build-in Middleware/Filter](/ENG//ENG/ENG-05-Middleware-and-Filter#Built-in-Middleware/Filter) - * [Custom Middleware/Filter](/ENG//ENG/ENG-05-Middleware-and-Filter#Custom-Middleware/Filter) -* [View](/ENG//ENG/ENG-06-View) - * [Drogon's CSP](/ENG//ENG/ENG-06-View#Drogon's-CSP) - * [Automated processing of csp files](/ENG//ENG/ENG-06-View#Automated-processing-of-csp-files) - * [Dynamic compilation and loading of views](/ENG//ENG/ENG-06-View#Dynamic-compilation-and-loading-of-views) -* [Session](/ENG//ENG/ENG-07-Session) -* [Database](/ENG//ENG/ENG-08-0-Database-General) - * [DbClient](/ENG//ENG/ENG-08-1-Database-DbClient) - * [Execution Interface](/ENG//ENG/ENG-08-1-Database-DbClient#Execution-Interface) - * [execSqlAsync](/ENG//ENG/ENG-08-1-Database-DbClient#execSqlAsync) - * [execSqlAsyncFuture](/ENG//ENG/ENG-08-1-Database-DbClient#execSqlAsyncFuture) - * [execSqlSync](/ENG//ENG/ENG-08-1-Database-DbClient#execSqlSync) - * [operator<<](/ENG//ENG/ENG-08-1-Database-DbClient#operator<<) - * [Transaction](/ENG//ENG/ENG-08-2-Database-Transaction) - * [ORM](/ENG//ENG/ENG-08-3-Database-ORM) - * [Model Class Interface](/ENG//ENG/ENG-08-3-Database-ORM#Model-Class-Interface) - * [Mapper Class Template](/ENG//ENG/ENG-08-3-Database-ORM#Mapper-Class-Template) - * [Criteria](/CHN//CHN/CHN-08-3-Database-ORM#Criteria) - * [Mapper's Chain Interface](/CHN//CHN/CHN-08-3-Database-ORM#Mapper's-Chain-Interface) - * [Convert](/CHN//CHN/CHN-08-3-Database-ORM#Convert) - * [Relationships](/CHN//CHN/CHN-08-3-Database-ORM#Relationships) - * [has one](/CHN//CHN/CHN-08-3-Database-ORM#has-one) - * [has many](/CHN//CHN/CHN-08-3-Database-ORM#has-many) - * [many to many](/CHN//CHN/CHN-08-3-Database-ORM#many-to-many) - * [FastDbClient](/ENG//ENG/ENG-08-4-Database-FastDbClient) - * [Automatic batch mode](/ENG//ENG/ENG-08-5-Database-auto_batch) -* [Plugins](/ENG//ENG/ENG-09-Plugins) -* [Configuration File](/ENG//ENG/ENG-10-Configuration-File) -* [drogon_ctl Command](/ENG//ENG/ENG-11-drogon_ctl-Command) -* [AOP](/ENG//ENG/ENG-12-AOP-Aspect-Oriented-Programming) -* [Benchmarks](/ENG//ENG/ENG-13-Benchmarks) -* [Coz profiling](/ENG//ENG/ENG-14-Coz) -* [Brotli info](/ENG//ENG/ENG-15-Brotli) -* [Coroutines](/ENG//ENG/ENG-16-Coroutines) -* [Redis](/ENG//ENG/ENG-17-Redis) -* [Testing Framework](/ENG//ENG/ENG-18-Testing-Framework) -* [FAQ](/ENG//ENG/ENG-FAQ) - * [Understanding drogon's threading model](/ENG//ENG/ENG-FAQ-1-Understanding-drogon-threading-model) +### [Welcome to the drogon wiki!](/ENG/ENG-01-Overview) +* [Overview](/ENG/ENG-01-Overview) +* [Install drogon](/ENG/ENG-02-Installation) + * [System Requirements](/ENG/ENG-02-Installation#System-Requirements) + * [Library Dependencies](/ENG/ENG-02-Installation#Library-Dependencies) + * [System Preparation Examples](/ENG/ENG-02-Installation#System-Preparation-Examples) + * [Ubuntu](/ENG/ENG-02-Installation#Ubuntu-1804) + * [CentOS](/ENG/ENG-02-Installation#CentOS-75) + * [MacOS](/ENG/ENG-02-Installation#MacOS-122) + * [Windows](/ENG/ENG-02-Installation#Windows) + * [Database Environment](/ENG/ENG-02-Installation#Database-Environment) + * [PostgreSQL](/ENG/ENG-02-Installation#PostgreSQL) + * [MySQL](/ENG/ENG-02-Installation#MySQL) + * [SQLite3](/ENG/ENG-02-Installation#SQLite3) + * [Redis](/ENG/ENG-02-Installation#Redis) + * [Drogon Installation](/ENG/ENG-02-Installation#Drogon-Installation) + * [Install by source in Linux](/ENG/ENG-02-Installation#Install-by-source-in-Linux) + * [Install by source in Windows](/ENG/ENG-02-Installation#Install-by-source-in-Windows) + * [Install by vcpkg in Windows](/ENG/ENG-02-Installation#Install-by-vcpkg-in-Windows) + * [Use Docker Image](/ENG/ENG-02-Installation#Use-Docker-Image) + * [Use Nix Package](/ENG/ENG-02-Installation#Use-Nix-Package) + * [Use CPM.cmake](/CHN/CHN/CHN-02-安装#Use-CPM.cmake) + * [Include drogon source code locally](/ENG/ENG-02-Installation#Include-drogon-source-code-locally) +* [Quick Start](/ENG/ENG-03-Quick-Start) + * [Static Site](/ENG/ENG-03-Quick-Start#Static-Site) + * [Dynamic Site](/ENG/ENG-03-Quick-Start#Dynamic-Site) +* [Controller](/ENG/ENG-04-0-Controller-Introduction) + * [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) + * [HttpController](/ENG/ENG-04-2-Controller-HttpController) + * [Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Path-Mapping) + * [Parameter Mapping](/ENG/ENG-04-2-Controller-HttpController#Parameter-Mapping) + * [Multiple Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Multiple-Path-Mapping) + * [Regular Expressions Mapping](/ENG/ENG-04-2-Controller-HttpController#Regular-Expressions-Mapping) + * [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) + * [Path Mapping](/ENG/ENG-04-3-Controller-WebSocketController#Path-Mapping) + * [Interface](/ENG/ENG-04-3-Controller-WebSocketController#Interface) +* [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) + * [Build-in Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Built-in-Middleware/Filter) + * [Custom Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Custom-Middleware/Filter) +* [View](/ENG/ENG-06-View) + * [Drogon's CSP](/ENG/ENG-06-View#Drogon's-CSP) + * [Automated processing of csp files](/ENG/ENG-06-View#Automated-processing-of-csp-files) + * [Dynamic compilation and loading of views](/ENG/ENG-06-View#Dynamic-compilation-and-loading-of-views) +* [Session](/ENG/ENG-07-Session) +* [Database](/ENG/ENG-08-0-Database-General) + * [DbClient](/ENG/ENG-08-1-Database-DbClient) + * [Execution Interface](/ENG/ENG-08-1-Database-DbClient#Execution-Interface) + * [execSqlAsync](/ENG/ENG-08-1-Database-DbClient#execSqlAsync) + * [execSqlAsyncFuture](/ENG/ENG-08-1-Database-DbClient#execSqlAsyncFuture) + * [execSqlSync](/ENG/ENG-08-1-Database-DbClient#execSqlSync) + * [operator<<](/ENG/ENG-08-1-Database-DbClient#operator<<) + * [Transaction](/ENG/ENG-08-2-Database-Transaction) + * [ORM](/ENG/ENG-08-3-Database-ORM) + * [Model Class Interface](/ENG/ENG-08-3-Database-ORM#Model-Class-Interface) + * [Mapper Class Template](/ENG/ENG-08-3-Database-ORM#Mapper-Class-Template) + * [Criteria](/CHN/CHN/CHN-08-3-Database-ORM#Criteria) + * [Mapper's Chain Interface](/CHN/CHN/CHN-08-3-Database-ORM#Mapper's-Chain-Interface) + * [Convert](/CHN/CHN/CHN-08-3-Database-ORM#Convert) + * [Relationships](/CHN/CHN/CHN-08-3-Database-ORM#Relationships) + * [has one](/CHN/CHN/CHN-08-3-Database-ORM#has-one) + * [has many](/CHN/CHN/CHN-08-3-Database-ORM#has-many) + * [many to many](/CHN/CHN/CHN-08-3-Database-ORM#many-to-many) + * [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) + * [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) +* [Plugins](/ENG/ENG-09-Plugins) +* [Configuration File](/ENG/ENG-10-Configuration-File) +* [drogon_ctl Command](/ENG/ENG-11-drogon_ctl-Command) +* [AOP](/ENG/ENG-12-AOP-Aspect-Oriented-Programming) +* [Benchmarks](/ENG/ENG-13-Benchmarks) +* [Coz profiling](/ENG/ENG-14-Coz) +* [Brotli info](/ENG/ENG-15-Brotli) +* [Coroutines](/ENG/ENG-16-Coroutines) +* [Redis](/ENG/ENG-17-Redis) +* [Testing Framework](/ENG/ENG-18-Testing-Framework) +* [FAQ](/ENG/ENG-FAQ) + * [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) ### To contribute to the wiki, please visit the [drogon-docs](https://github.com/drogonframework/drogon-docs) repository. From 656c4f39fb8b2474215fbb1756aa176d18f1a804 Mon Sep 17 00:00:00 2001 From: Chuck <32836622+chuckn408@users.noreply.github.com> Date: Mon, 1 Jul 2024 12:29:06 -0700 Subject: [PATCH 6/7] derp --- "CHN/CHN-01-\346\246\202\350\277\260.md" | 2 +- ENG/ENG-01-Overview.md | 10 +------ ENG/ENG-02-Installation.md | 11 ++------ ENG/ENG-03-Quick-Start.md | 19 +++++-------- ENG/ENG-04-0-Controller-Introduction.md | 13 ++------- ...NG-04-1-Controller-HttpSimpleController.md | 16 ++++------- ENG/ENG-04-2-Controller-HttpController.md | 12 +++------ ...ENG-04-3-Controller-WebSocketController.md | 16 ++++------- ENG/ENG-05-Middleware-and-Filter.md | 17 +++--------- ENG/ENG-06-View.md | 12 +++------ ENG/ENG-07-Session.md | 11 ++------ ENG/ENG-08-0-Database-General.md | 13 ++------- ENG/ENG-08-1-Database-DbClient.md | 15 +++-------- ENG/ENG-08-2-Database-Transaction.md | 12 +++------ ENG/ENG-08-3-Database-ORM.md | 19 +++++-------- ENG/ENG-08-4-Database-FastDbClient.md | 15 +++-------- ENG/ENG-08-5-Database-auto_batch.md | 11 ++------ ENG/ENG-09-0-References-request.md | 13 +++------ ENG/ENG-09-1-File-Handler.md | 7 ++--- ENG/ENG-10-Plugins.md | 11 ++------ ENG/ENG-11-Configuration-File.md | 27 +++++++------------ ENG/ENG-12-drogon_ctl-Command.md | 23 ++++++---------- ENG/ENG-13-AOP-Aspect-Oriented-Programming.md | 11 ++------ ENG/ENG-14-Benchmarks.md | 11 ++------ ENG/ENG-15-Coz.md | 11 ++------ ENG/ENG-16-Brotli.md | 11 ++------ ENG/ENG-17-Coroutines.md | 11 ++------ ENG/ENG-18-Redis.md | 15 +++-------- ENG/ENG-19-Testing-Framework.md | 5 +--- ...-1-Understanding-drogon-threading-model.md | 5 +--- ENG/ENG-FAQ.md | 11 ++------ ENG/Home.md | 6 ++--- 32 files changed, 101 insertions(+), 301 deletions(-) diff --git "a/CHN/CHN-01-\346\246\202\350\277\260.md" "b/CHN/CHN-01-\346\246\202\350\277\260.md" index 63b9654..178d75c 100644 --- "a/CHN/CHN-01-\346\246\202\350\277\260.md" +++ "b/CHN/CHN-01-\346\246\202\350\277\260.md" @@ -29,4 +29,4 @@ Drogon的主要应用平台是Linux,也支持Mac OS、FreeBSD和Windows。 * 支持插件,可通过配置文件在加载期动态拆装; * 支持内建插入点的AOP -# 02 [安装drogon](/CHN/CHN-02-安装) +# 02 [安装drogon](/CHN/CHN-02-安装) \ No newline at end of file diff --git a/ENG/ENG-01-Overview.md b/ENG/ENG-01-Overview.md index e65e361..83d54e4 100644 --- a/ENG/ENG-01-Overview.md +++ b/ENG/ENG-01-Overview.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-01-概述) -======= -##### Other languages: [简体中文](/CHN/CHN-01-概述) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 **Drogon** is a C++20-based HTTP application framework. Drogon can be used to easily build various types of web application server programs using C++. @@ -35,8 +31,4 @@ Its main features are as follows: * Support plugins which can be installed by the configuration file at load time; * Support AOP with build-in joinpoints. -<<<<<<< HEAD -# Next: [Install drogon](/ENG/ENG-02-Installation) -======= -# Next: [Install drogon](/ENG/ENG-02-Installation) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 +# Next: [Install drogon](/ENG/ENG-02-Installation) \ No newline at end of file diff --git a/ENG/ENG-02-Installation.md b/ENG/ENG-02-Installation.md index 2820ff0..a9a96f1 100644 --- a/ENG/ENG-02-Installation.md +++ b/ENG/ENG-02-Installation.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-02-安装) -======= -##### Other languages: [简体中文](/CHN/CHN-02-安装) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 This section takes Ubuntu 18.04, CentOS 7.5, MacOS 12.2 as an example to introduce the installation process. Other systems are similar; @@ -485,8 +481,5 @@ Assuming that the above environment and library dependencies are all ready, the target_link_libraries(${PROJECT_NAME} PRIVATE drogon) ``` -<<<<<<< HEAD -# Next: [Quick Start](/ENG/ENG-03-Quick-Start) -======= -# Next: [Quick Start](/ENG/ENG-03-Quick-Start) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Quick Start](/ENG/ENG-03-Quick-Start) \ No newline at end of file diff --git a/ENG/ENG-03-Quick-Start.md b/ENG/ENG-03-Quick-Start.md index 6ffe275..9253a6d 100644 --- a/ENG/ENG-03-Quick-Start.md +++ b/ENG/ENG-03-Quick-Start.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-03-快速开始) -======= -##### Other languages: [简体中文](/CHN/CHN-03-快速开始) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 ## Static Site @@ -26,11 +22,11 @@ There are several useful folders in the project directory already: └── views The folder where view csp files are stored ``` -<<<<<<< HEAD + Users can put various files (such as controllers, filters, views, etc.) into the corresponding folders. For more convenience and less error, we strongly recommend that users create their own web application projects using the `drogon_ctl` command. See [drogon_ctl](/ENG/ENG-11-drogon_ctl-Command) for more details. ======= Users can put various files (such as controllers, filters, views, etc.) into the corresponding folders. For more convenience and less error, we strongly recommend that users create their own web application projects using the `drogon_ctl` command. See [drogon_ctl](/ENG/ENG-11-drogon_ctl-Command) for more details. ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + Let's look at the main.cc file: @@ -63,11 +59,11 @@ Now, we simply add one static file index.html to the Http root path: echo '

Hello Drogon!

' >>index.html ``` -<<<<<<< HEAD + The default root path is `"./"`, but could also be modified by config.json. See [Configuration File](/ENG/ENG-10-Configuration-File) for more details. Then you can visit this page by URL `"http://localhost"` or`"http://localhost/index.html"` (or the IP of the server where your wepapp is running). ======= The default root path is `"./"`, but could also be modified by config.json. See [Configuration File](/ENG/ENG-10-Configuration-File) for more details. Then you can visit this page by URL `"http://localhost"` or`"http://localhost/index.html"` (or the IP of the server where your wepapp is running). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + ![Hello Drogon!](/images/hellodrogon.png) @@ -206,8 +202,5 @@ We see that adding a controller to an application is very simple. You only need > **Note: Drogon has no restrictions on the location of the controller source files. You could also save them in "./" (the project root directory), or you could even define a new directory in `CMakeLists.txt`. It is recommended to use the controllers directory for the convenience of management.** -<<<<<<< HEAD -# Next: [drogon_ctl Command](/ENG/ENG-04-0-Controller-Introduction) -======= -# Next: [drogon_ctl Command](/ENG/ENG-04-0-Controller-Introduction) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [drogon_ctl Command](/ENG/ENG-04-0-Controller-Introduction) \ No newline at end of file diff --git a/ENG/ENG-04-0-Controller-Introduction.md b/ENG/ENG-04-0-Controller-Introduction.md index 277fa7e..9b02da1 100644 --- a/ENG/ENG-04-0-Controller-Introduction.md +++ b/ENG/ENG-04-0-Controller-Introduction.md @@ -1,12 +1,6 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-04-控制器-简介) The controller is very important in web application development. This is where we will define our URLs, which HTTP methods are allowed, which [filters](/ENG/ENG-06-Middleware-and-Filter) will be applied and how requests will be processed and responded to. The drogon framework has helped us to handle the network transmission, Http protocol analysis and so on. We only need to pay attention to the logic of the controller; each controller object can have one or more processing functions (generally called handlers), and the interface of the function is generally defined as follows: -======= -##### Other languages: [简体中文](/CHN/CHN-04-控制器-简介) - -The controller is very important in web application development. This is where we will define our URLs, which HTTP methods are allowed, which [filters](/ENG/ENG-06-Middleware-and-Filter) will be applied and how requests will be processed and responded to. The drogon framework has helped us to handle the network transmission, Http protocol analysis and so on. We only need to pay attention to the logic of the controller; each controller object can have one or more processing functions (generally called handlers), and the interface of the function is generally defined as follows: ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 ```c++ Void handlerName(const HttpRequestPtr &req, @@ -39,8 +33,5 @@ public: A controller registered to a drogon framework will have at most only one instance and will not be destroyed during the entire application run, so users can declare and use member variables in the controller class. Note that when the handler of the controller is called, it is in a multi-threaded environment (when the number of IO threads of the framework is configured to be greater than 1), if you need to access non-temporary variables, please do the concurrent protection work. -<<<<<<< HEAD -# Next: [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) -======= -# Next: [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) \ No newline at end of file diff --git a/ENG/ENG-04-1-Controller-HttpSimpleController.md b/ENG/ENG-04-1-Controller-HttpSimpleController.md index d1eba48..08eb2e5 100644 --- a/ENG/ENG-04-1-Controller-HttpSimpleController.md +++ b/ENG/ENG-04-1-Controller-HttpSimpleController.md @@ -1,8 +1,5 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-04-1-控制器-HttpSimpleController) -======= -##### Other languages: [简体中文](/CHN/CHN-04-1-控制器-HttpSimpleController) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + You could use the `drogon_ctl` command line tool to quickly generate custom controller class source files based on `HttpSimpleController`. The command format is as bellow: @@ -51,11 +48,11 @@ Each HttpSimpleController class can only define one Http request handler, and it The route (or called mapping) from the URL path to the handler is done by a macro. You could add multipath mappings with the `PATH_ADD` macro. All `PATH_ADD` statements should be set between the `PATH_LIST_BEGIN` and `PATH_LIST_END` macro statements. -<<<<<<< HEAD + The first parameter is the path to be mapped, and parameters beyond the path are constraints on this path. Currently, two types of constraints are supported. One is the `HttpMethod` enum Type, which means the Http method allowed. The other type is the name of the `HttpFilter` class. One can configure any number of these two types of constraints, and there are no order requirements for them. For Filter, please refer to [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter). ======= The first parameter is the path to be mapped, and parameters beyond the path are constraints on this path. Currently, two types of constraints are supported. One is the `HttpMethod` enum Type, which means the Http method allowed. The other type is the name of the `HttpFilter` class. One can configure any number of these two types of constraints, and there are no order requirements for them. For Filter, please refer to [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + Users can register the same Simple Controller to multiple paths, or register multiple Simple Controllers on the same path (using different HTTP methods). @@ -72,8 +69,5 @@ You could define an HttpResponse class variable, and then use the callback() to > **The mapping from the above path to the handler is done at compile time. In fact, the drogon framework also provides an interface for runtime completion mapping. The runtime mapping allows the user to map or modify the mapping through configuration files or other user interfaces without recompiling this program (For performance reasons, it is forbidden to add any controller mapping after running the app().run() method).** -<<<<<<< HEAD -# Next: [HttpController](/ENG/ENG-04-2-Controller-HttpController) -======= -# Next: [HttpController](/ENG/ENG-04-2-Controller-HttpController) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [HttpController](/ENG/ENG-04-2-Controller-HttpController) \ No newline at end of file diff --git a/ENG/ENG-04-2-Controller-HttpController.md b/ENG/ENG-04-2-Controller-HttpController.md index a27648e..f0a1ab0 100644 --- a/ENG/ENG-04-2-Controller-HttpController.md +++ b/ENG/ENG-04-2-Controller-HttpController.md @@ -1,8 +1,5 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-04-2-控制器-HttpController) -======= -##### Other languages: [简体中文](/CHN/CHN-04-2-控制器-HttpController) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + ### Generation @@ -283,8 +280,5 @@ Each `HttpController` class can define many Http request handlers. Since the num > **It should be noted that when using regular expressions, you should pay attention to matching conflicts (multiple different handlers are matched). When conflicts happen in the same controller, drogon will only execute the first handler (the one registered in the framework first). When conflicts happen between different controllers, it is uncertain which handler will be executed. Therefore, users need to avoid these conflicts.** -<<<<<<< HEAD -# Next: [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) -======= -# Next: [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) \ No newline at end of file diff --git a/ENG/ENG-04-3-Controller-WebSocketController.md b/ENG/ENG-04-3-Controller-WebSocketController.md index 754de6e..fd5d6c7 100644 --- a/ENG/ENG-04-3-Controller-WebSocketController.md +++ b/ENG/ENG-04-3-Controller-WebSocketController.md @@ -1,8 +1,5 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-04-3-控制器-WebSocketController) -======= -##### Other languages: [简体中文](/CHN/CHN-04-3-控制器-WebSocketController) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + As the name implies, `WebSocketController` is used to process websocket logic. Websocket is a persistent HTTP-based connection scheme. At the beginning of the websocket, there is an HTTP format request and response exchange. After the websocket connection is established, all messages are transmitted on the websocket. The message is wrapped in a fixed format. There is no limit to the message content and the order in which messages are transmitted. @@ -104,11 +101,11 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr } ``` -<<<<<<< HEAD + First, in this example, the controller is registered to the `/echo` path via the `WS_PATH_ADD` macro. The usage of the `WS_PATH_ADD` macro is similar to the macros of other controllers introduced earlier. One can also register the path with several [Filters](/ENG/ENG-05-Middleware-and-Filter). Since websocket is handled separately in the framework, it can be repeated with the paths of the first two controllers(`HttpSimpleController` and `HttpApiController`) without affecting each other. ======= First, in this example, the controller is registered to the `/echo` path via the `WS_PATH_ADD` macro. The usage of the `WS_PATH_ADD` macro is similar to the macros of other controllers introduced earlier. One can also register the path with several [Filters](/ENG/ENG-05-Middleware-and-Filter). Since websocket is handled separately in the framework, it can be repeated with the paths of the first two controllers(`HttpSimpleController` and `HttpApiController`) without affecting each other. ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + Secondly, in the implementation of the three virtual functions in this example, only the handleNewMessage has the substance, but simply sends the received message back to the client through the send interface.Compile this controller into the framework, you can see the effect, please test it yourself. @@ -158,8 +155,5 @@ void EchoWebsock::handleConnectionClosed(const WebSocketConnectionPtr &wsConnPtr any *getMutableContext(); ``` -<<<<<<< HEAD -# Next: [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) -======= -# Next: [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) \ No newline at end of file diff --git a/ENG/ENG-05-Middleware-and-Filter.md b/ENG/ENG-05-Middleware-and-Filter.md index 0f895b6..a3a1120 100644 --- a/ENG/ENG-05-Middleware-and-Filter.md +++ b/ENG/ENG-05-Middleware-and-Filter.md @@ -1,12 +1,6 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-05-中间件和过滤器) In HttpController's [example](/ENG/ENG-04-2-Controller-HttpController), the getInfo method should check whether the user is logged in before returning the user's information. We can write this logic in the getInfo method, but obviously, checking the user's login membership is general logic which will be used by many interfaces, it should be extracted separately and configured before calling handler, which is what filters do. -======= -##### Other languages: [简体中文](/CHN/CHN-05-中间件和过滤器) - -In HttpController's [example](/ENG/ENG-04-2-Controller-HttpController), the getInfo method should check whether the user is logged in before returning the user's information. We can write this logic in the getInfo method, but obviously, checking the user's login membership is general logic which will be used by many interfaces, it should be extracted separately and configured before calling handler, which is what filters do. ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 Drogon's middleware uses the onion model. After the framework completes URL path matching, it sequentially invokes the middleware registered for that path. Within each middleware, users can choose to intercept or pass through the request and add pre-processing and post-processing logic. @@ -77,11 +71,11 @@ Drogon contains the following common filters: }; ``` -<<<<<<< HEAD + You could create filter by the `drogon_ctl` command, see [drogon_ctl](/ENG/ENG-11-drogon_ctl-command#Filter-creation). ======= You could create filter by the `drogon_ctl` command, see [drogon_ctl](/ENG/ENG-11-drogon_ctl-command#Filter-creation). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + You need to override the doFilter virtual function of the parent class to implement the filter logic; @@ -110,8 +104,5 @@ Drogon contains the following common filters: > **Note: If the middleware/filter is defined in the namespace, you must write the namespace completely when you register it.** -<<<<<<< HEAD -# Next: [View](/ENG/ENG-06-View) -======= -# Next: [View](/ENG/ENG-06-View) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [View](/ENG/ENG-06-View) \ No newline at end of file diff --git a/ENG/ENG-06-View.md b/ENG/ENG-06-View.md index 7b4b278..6b3432d 100644 --- a/ENG/ENG-06-View.md +++ b/ENG/ENG-06-View.md @@ -1,8 +1,5 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-06-视图) -======= -##### Other languages: [简体中文](/CHN/CHN-06-视图) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + ### Views Introduction @@ -155,8 +152,5 @@ Obviously, this function depends on the development environment. If both drogon > **Note: If a `symbol not found` error occurs while loading a dynamic view, please use the `cmake .. -DCMAKE_ENABLE_EXPORTS=on` to configure your project, or uncomment the last line (`set_property(TARGET ${PROJECT_NAME} PROPERTY ENABLE_EXPORTS ON)`) in your project's CMakeLists.txt, and then rebuild the project** -<<<<<<< HEAD -# Next: [Session](/ENG/ENG-07-Session) -======= -# Next: [Session](/ENG/ENG-07-Session) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Session](/ENG/ENG-07-Session) \ No newline at end of file diff --git a/ENG/ENG-07-Session.md b/ENG/ENG-07-Session.md index 9fa90e3..ade83dd 100644 --- a/ENG/ENG-07-Session.md +++ b/ENG/ENG-07-Session.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-07-会话) -======= -##### Other languages: [简体中文](/CHN/CHN-07-会话) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 `Session` is an important concept of the web application. It is used to save the state of the client on the server. Generally, it cooperates with the browser's `cookie`, and drogon provides support for the session. Drogon **close** the session selection by default, you can also close or open it through the following interface: @@ -100,8 +96,5 @@ drogon::HttpAppFramework::instance().enableSession(1200); Recompile the entire project with CMake, run the target program webapp, and you can see the effect through the browser. -<<<<<<< HEAD -# Next: [Database](/ENG/ENG-08-0-Database-General) -======= -# Next: [Database](/ENG/ENG-08-0-Database-General) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Database](/ENG/ENG-08-0-Database-General) \ No newline at end of file diff --git a/ENG/ENG-08-0-Database-General.md b/ENG/ENG-08-0-Database-General.md index a39c1ab..8c91e5b 100644 --- a/ENG/ENG-08-0-Database-General.md +++ b/ENG/ENG-08-0-Database-General.md @@ -1,16 +1,8 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-08-0-数据库-概述) ### General **Drogon** has built-in database read/write engine. The operation of database connection is based on non-blocking I/O technology. Therefore, the application works in an efficient non-blocking asynchronous mode from the bottom to the upper layer, which ensures Drogon's high concurrency performance. Currently, Drogon supports PostgreSQL and MySQL databases. If you want to use a database, the development environment of the corresponding database must be installed first. Drogon will automatically detect the header files and library files of these libraries and compile the corresponding parts. For the preparation of the database development environment, see [Development Environment](/ENG/ENG-02-Installation#Database-Environment). -======= -##### Other languages: [简体中文](/CHN/CHN-08-0-数据库-概述) - -### General - -**Drogon** has built-in database read/write engine. The operation of database connection is based on non-blocking I/O technology. Therefore, the application works in an efficient non-blocking asynchronous mode from the bottom to the upper layer, which ensures Drogon's high concurrency performance. Currently, Drogon supports PostgreSQL and MySQL databases. If you want to use a database, the development environment of the corresponding database must be installed first. Drogon will automatically detect the header files and library files of these libraries and compile the corresponding parts. For the preparation of the database development environment, see [Development Environment](/ENG/ENG-02-Installation#Database-Environment). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 **Drogon** supports the sqlite3 database in order to support lightweight applications. The asynchronous interface is implemented through the thread pool, which is the same as the interfaces of the aforementioned databases. @@ -22,7 +14,7 @@ The basic class of Drogon's database is `DbClient` (this is an abstract class, t Usually, when an asynchronous interface is called, `DbClient` will randomly select one of the idle connections it manages to perform related query operations. When the result returns, `DbClient` will process the data and return it to the caller through the callback function object; Without an idle connection, the execution content will be cached. Once a connection has executed its own sql request, the pending command will be fetched from the cache to execute. -<<<<<<< HEAD + For details on `DbClient`, see [DbClient](/ENG/ENG-08-1-Database-DbClient). ### Transaction @@ -45,5 +37,4 @@ The transaction object can be generated by `DbClient` to support transaction ope Drogon also provides support for **ORM**. Users can use the drogon_ctl command to read the tables in the database and generate the corresponding model source code. Then, execute the database operations of these models through the `Mapper` class template. Mapper provides simple and convenient interfaces for standard database operations, allowing users to make the additions, deletions, and changes to the table without writing sql statements. For **ORM**, please refer to [ORM](/ENG/ENG-08-3-Database-ORM) -# Next: [DbClient](/ENG/ENG-08-1-Database-DbClient) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 +# Next: [DbClient](/ENG/ENG-08-1-Database-DbClient) \ No newline at end of file diff --git a/ENG/ENG-08-1-Database-DbClient.md b/ENG/ENG-08-1-Database-DbClient.md index c30c4cd..01aa2ab 100644 --- a/ENG/ENG-08-1-Database-DbClient.md +++ b/ENG/ENG-08-1-Database-DbClient.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-08-1-数据库-DbClient) -======= -##### Other languages: [简体中文](/CHN/CHN-08-1-数据库-DbClient) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 ### DbClient Object Construction @@ -24,11 +20,11 @@ The object obtained by the above method, the user has to find a way to persist i - This will waste time creating connections and disconnections, increasing system latency; - The interface is also a non-blocking interface. That is to say, when the user gets the DbClient object, the connection managed by the it has not been established yet. The framework does not (intentionally) provide a callback interface for successful connection establishment. Do you still have to sleep before starting the query?? This is contrary to the original intention of the asynchronous framework. -<<<<<<< HEAD + Therefore, DbClient objects should be built at the beginning of the program and held and used throughout the life time. Obviously, this work can be done entirely by the framework. So the drogon framework provides the second build method, which is built by configuration file or the `createDbClient()` method. For the configuration method of the configuration file, see [db_clients](/ENG/ENG-10-Configuration-file#db_clients). ======= Therefore, DbClient objects should be built at the beginning of the program and held and used throughout the life time. Obviously, this work can be done entirely by the framework. So the drogon framework provides the second build method, which is built by configuration file or the `createDbClient()` method. For the configuration method of the configuration file, see [db_clients](/ENG/ENG-10-Configuration-file#db_clients). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + When needed, the DbClient smart pointer is obtained through the interface of the framework. The interface is as follows: @@ -261,8 +257,5 @@ Each DbClient object has one or multiple its own EventLoop threads controlling t Blocking interfaces of DbClient only block the caller thread, as long as the caller thread is not the EventLoop thread, it will not affect the normal operation of the EventLoop thread. When the callback function is called, the program inside the callback is run on the EventLoop thread. Therefore, do not perform any blocking operations within the callback, otherwise it will affect the concurrency performance of database read and write. Anyone familiar with non-blocking I/O programming should understand this constraint. -<<<<<<< HEAD -# Next: [Transaction](/ENG/ENG-08-2-Database-Transaction) -======= -# Next: [Transaction](/ENG/ENG-08-2-Database-Transaction) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Transaction](/ENG/ENG-08-2-Database-Transaction) \ No newline at end of file diff --git a/ENG/ENG-08-2-Database-Transaction.md b/ENG/ENG-08-2-Database-Transaction.md index 57189fb..12d6b50 100644 --- a/ENG/ENG-08-2-Database-Transaction.md +++ b/ENG/ENG-08-2-Database-Transaction.md @@ -1,8 +1,5 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-08-2-数据库-事务) -======= -##### Other languages: [简体中文](/CHN/CHN-08-2-数据库-事务) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + > **Transactions** are an important feature of relational databases, and Drogon provides transaction support with the `Transaction` class. @@ -87,8 +84,5 @@ For the simplest example, suppose there is a task table from which the user sele In this case, select for update is used to avoid concurrent modifications. The update statement is completed in the result callback of the select statement. The outermost braces are used to limit the scope of the transPtr so that it can be destroyed in time after the execution of sql to end the transaction. -<<<<<<< HEAD -# Next: [ORM](/ENG/ENG-08-3-Database-ORM) -======= -# Next: [ORM](/ENG/ENG-08-3-Database-ORM) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [ORM](/ENG/ENG-08-3-Database-ORM) \ No newline at end of file diff --git a/ENG/ENG-08-3-Database-ORM.md b/ENG/ENG-08-3-Database-ORM.md index d06419c..dfba292 100644 --- a/ENG/ENG-08-3-Database-ORM.md +++ b/ENG/ENG-08-3-Database-ORM.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-08-3-数据库-ORM) -======= -##### Other languages: [简体中文](/CHN/CHN-08-3-数据库-ORM) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 ### Model @@ -34,11 +30,11 @@ The last parameter is the path to store model classes. There must be a configura } ``` -<<<<<<< HEAD + The configured parameters are the same as the application's configuration file. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). ======= The configured parameters are the same as the application's configuration file. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + The `tables` configuration option is unique to the model configuration. It is an array of strings. Each string represents the name of the table to be converted into a model class. If this option is empty, all tables will be used to generate model classes. @@ -107,11 +103,11 @@ template explicit Criteria(const CustomSql &sql, Arguments &&...args) ``` -<<<<<<< HEAD + The first argument is a `CustomSql` object of sql statements with `$?` placeholders, while the `CustomSql` class is just a wrapper of a std::string. The second indefinite argument is a parameter pack represents the bound parameter, which behaves just like the ones in [execSqlAsync](/ENG/ENG-08-1-Database-DbClient.md#execSqlAsync). ======= The first argument is a `CustomSql` object of sql statements with `$?` placeholders, while the `CustomSql` class is just a wrapper of a std::string. The second indefinite argument is a parameter pack represents the bound parameter, which behaves just like the ones in [execSqlAsync](/ENG/ENG-08-1-Database-DbClient.md#execSqlAsync). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + E.g: @@ -298,8 +294,5 @@ drogon_ctl can also generate restful-style controllers for each model (or table) It should be noted that the controller of each table is designed to be composed of a base class and a subclass. Among them, the base class and the table are closely related, and the subclass is used to implement special business logic or modify the interface format. The advantage of this design is that when the table structure changes, users can update only the base class without overwriting the subclass(by setting the `generate_base_only` option to `true`). -<<<<<<< HEAD -# Next: [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) -======= -# Next: [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) \ No newline at end of file diff --git a/ENG/ENG-08-4-Database-FastDbClient.md b/ENG/ENG-08-4-Database-FastDbClient.md index c93a5bc..39a1c5e 100644 --- a/ENG/ENG-08-4-Database-FastDbClient.md +++ b/ENG/ENG-08-4-Database-FastDbClient.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-08-4-数据库-FastDbClient) -======= -##### Other languages: [简体中文](/CHN/CHN-08-4-数据库-FastDbClient) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 As the name implies, FastDbClient will provide higher performance than the normal DbClient. Unlike DbClient has own event loop, it shares the event loop with network IO threads and the main thread of the web application, which makes the internal implementation of FastDbClient available in a lock-free mode and more efficient. @@ -14,11 +10,11 @@ FastDbClient must be created automatically by the framework with the configurati The sub-option `is_fast` of the db_client option in the configuration file indicates if the client is a FastDbClient.Or user can create a FastDbClient by calling the app.createDbClient() method with the last parameter set to true. -<<<<<<< HEAD + The framework creates a separate FastDbClient for each IO's event loop and the main event loop, and each FastDbClient manages several database connections internally. The number of event loop of IO is controlled by the framework's "threads_num" option, which is generally set to the number of CPU cores of the host. The number of the DB connections per event loop is the value of the DB client "connection_number" option. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). Therefore, the total number of DB connections held by FastDbClient is `(threads_num+1) * connection_number`. ======= The framework creates a separate FastDbClient for each IO's event loop and the main event loop, and each FastDbClient manages several database connections internally. The number of event loop of IO is controlled by the framework's "threads_num" option, which is generally set to the number of CPU cores of the host. The number of the DB connections per event loop is the value of the DB client "connection_number" option. Please refer to [Configuration File](/ENG/ENG-10-Configuration-File#db_clients). Therefore, the total number of DB connections held by FastDbClient is `(threads_num+1) * connection_number`. ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + The interface to get a FastDbClient is similar to the normal DbClient, as follows: @@ -38,8 +34,5 @@ The use of FastDbClient is almost identical to that of the normal DbClient, exce - Synchronous transaction creation interfaces are likely to block (when all connections are busy), so FastDbClient's synchronous transaction creation interface returns null pointers directly. If you want to use transactions on FastDbClient, please use the asynchronous transaction creation interface. - After using the FastDbClient to create an Orm Mapper object, you should also use only asynchronous non-blocking interfaces of the mapper object. -<<<<<<< HEAD -# Next: [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) -======= -# Next: [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) \ No newline at end of file diff --git a/ENG/ENG-08-5-Database-auto_batch.md b/ENG/ENG-08-5-Database-auto_batch.md index ee6cab9..1097120 100644 --- a/ENG/ENG-08-5-Database-auto_batch.md +++ b/ENG/ENG-08-5-Database-auto_batch.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-08-5-数据库-自动批处理) -======= -##### Other languages: [简体中文](/CHN/CHN-08-5-数据库-自动批处理) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 The automatic batch mode is only valid for the client library of postgresql 14+ version, and will be ignored in other cases. Before talking about automatic batch processing, let's understand the pipeline mode first. @@ -37,8 +33,5 @@ Therefore, automatic batch mode is helpful to improve performance, but it is not When using the newPgClient interface to create a client, set the third parameter to true to enable automatic batch mode; When using a configuration file to create a client, set the auto_batch option to true to enable automatic batch mode for the client; -<<<<<<< HEAD -# Next: [Request References](/ENG/ENG-09-0-References-request) -======= -# Next: [Request References](/ENG/ENG-09-0-References-request) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Request References](/ENG/ENG-09-0-References-request) \ No newline at end of file diff --git a/ENG/ENG-09-0-References-request.md b/ENG/ENG-09-0-References-request.md index 48feb15..c32809b 100644 --- a/ENG/ENG-09-0-References-request.md +++ b/ENG/ENG-09-0-References-request.md @@ -1,5 +1,3 @@ - - The HttpRequest type pointer commonly named `req` in the examples in this documentation represents the data contained in a request received or sent by drogon, below are the some methods by which you can interact with this object: - ### `isOnSecureConnection()` @@ -87,11 +85,11 @@ The HttpRequest type pointer commonly named `req` in the examples in this docume path() #### Summary: -<<<<<<< HEAD + Function that returns the request path. Useful if you use an ADD_METHOD_VIA_REGEX or other type of dynamic URL in the [controller](/ENG/ENG-04-2-Controller-HttpController). ======= Function that returns the request path. Useful if you use an ADD_METHOD_VIA_REGEX or other type of dynamic URL in the [controller](/ENG/ENG-04-2-Controller-HttpController). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + #### Inputs: None. @@ -269,12 +267,7 @@ void mycontroller::postfile(const HttpRequestPtr &req, std::function>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 +# Next: [Plugins](/ENG/ENG-09-1-File-Handler) \ No newline at end of file diff --git a/ENG/ENG-09-1-File-Handler.md b/ENG/ENG-09-1-File-Handler.md index a34aba2..94f643a 100644 --- a/ENG/ENG-09-1-File-Handler.md +++ b/ENG/ENG-09-1-File-Handler.md @@ -259,8 +259,5 @@ File parsing is extracting the file (or files) from a multipart-data POST reques } ``` -<<<<<<< HEAD -# Next: [Plugins](/ENG/ENG-10-Plugins) -======= -# Next: [Plugins](/ENG/ENG-10-Plugins) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Plugins](/ENG/ENG-10-Plugins) \ No newline at end of file diff --git a/ENG/ENG-10-Plugins.md b/ENG/ENG-10-Plugins.md index abf0244..5ece5b0 100644 --- a/ENG/ENG-10-Plugins.md +++ b/ENG/ENG-10-Plugins.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-09-插件) -======= -##### Other languages: [简体中文](/CHN/CHN-09-插件) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 Plugins are use to help users build complex applications. In Drogon, all plugins are built and installed into the application based on the configuration file. Plugins in Drogon are single-instance, and users can implement any functionality they want with plugins. @@ -78,8 +74,5 @@ Note that it is best to get the plugin after calling the framework's run() inter All plugins are initialized in the run() interface of the framework and are destroyed when the application exits. Therefore, the plugin's lifecycle is almost identical to the application, which is why the getPlugin() interface does not need to return a smart pointer. -<<<<<<< HEAD -# Next: [Configuration File](/ENG/ENG-11-Configuration-File) -======= -# Next: [Configuration File](/ENG/ENG-11-Configuration-File) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Configuration File](/ENG/ENG-11-Configuration-File) \ No newline at end of file diff --git a/ENG/ENG-11-Configuration-File.md b/ENG/ENG-11-Configuration-File.md index 630ee88..c211694 100644 --- a/ENG/ENG-11-Configuration-File.md +++ b/ENG/ENG-11-Configuration-File.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-10-配置文件) -======= -##### Other languages: [简体中文](/CHN/CHN-10-配置文件) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 You can control various behaviors of the Http server by configuring various parameters through multiple interfaces of the DrogonAppFramework instance. However, using a configuration file is a better way for the following reasons: @@ -112,11 +108,11 @@ After commenting out a configuration option, the framework initializes it with d - `dbname`:String, database name; - `user`:String, user name; - `passwd`:String, password; -<<<<<<< HEAD + - `is_fast`:bool,false by default, indicate if the client is a [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) ======= - `is_fast`:bool,false by default, indicate if the client is a [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + - `connection_number`:A integer indicating the number of connections to the database server, at least 1, the default value is also 1, affecting the concurrent performance of data read and write; If the 'is_fast' is true, the number is the number of connections per event loop, otherwise it is the total number of all connections. - `filename`: The filename of sqlite3 database; @@ -294,11 +290,11 @@ After commenting out a configuration option, the framework initializes it with d - ### simple_controllers_map -<<<<<<< HEAD + The `app` suboption, an array of JSON objects, each representing a mapping from the Http path to the HttpSimpleController, this configuration is just an alternative, not necessarily configured here, see [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController). ======= The `app` suboption, an array of JSON objects, each representing a mapping from the Http path to the HttpSimpleController, this configuration is just an alternative, not necessarily configured here, see [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + The specific configuration is as follows: ```json @@ -317,11 +313,11 @@ After commenting out a configuration option, the framework initializes it with d - `path`:String, Http path; - `controller`:String, the name of the HttpSimpleController; - `http_methods`:An array of strings representing the supported Http methods. Requests outside this list will be filtered out, returning a 405 error. -<<<<<<< HEAD + - `filters`:String array, list of filters on the path, see [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter); ======= - `filters`:String array, list of filters on the path, see [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter); ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + - ### Idle connection timeout control @@ -345,11 +341,11 @@ After commenting out a configuration option, the framework initializes it with d - `dynamic_views_path`:Boolean value, the default value is false. When it is true, the framework searches view files in the view path and dynamically compiles them into .so files, then loads them into the application. When any view file changes, it will also cause automatic compilation and re-loading; - `dynamic_views_path`:An array of strings, each of which represents the search path of the dynamic view. If the path value is not starting with `/`, `./` or `../`, and the value is not `.` or `..`, then This path is the relative path of the previous document_root entry, otherwise it is an absolute path or a relative path to the current directory. -<<<<<<< HEAD + See [View](/ENG/ENG-06-View) ======= See [View](/ENG/ENG-06-View) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + - ### Server header field @@ -375,8 +371,5 @@ After commenting out a configuration option, the framework initializes it with d "pipelining_requests": 0 ``` -<<<<<<< HEAD -# Next: [Aspect Oriented Programming (AOP)](/ENG/ENG-12-AOP-Aspect-Oriented-Programming) -======= -# Next: [Aspect Oriented Programming (AOP)](/ENG/ENG-12-AOP-Aspect-Oriented-Programming) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Aspect Oriented Programming (AOP)](/ENG/ENG-12-AOP-Aspect-Oriented-Programming) \ No newline at end of file diff --git a/ENG/ENG-12-drogon_ctl-Command.md b/ENG/ENG-12-drogon_ctl-Command.md index d5410a4..d9fe3cf 100644 --- a/ENG/ENG-12-drogon_ctl-Command.md +++ b/ENG/ENG-12-drogon_ctl-Command.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-11-drogon_ctl命令) -======= -##### Other languages: [简体中文](/CHN/CHN-11-drogon_ctl命令) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 After the **Drogon** framework is compiled and installed, it is recommended to create your first project using the command line program `drogon_ctl` which is installed alongside the framework, for convenience there is the shortened command `dg_ctl`. Users can choose according to their preferences. @@ -64,11 +60,11 @@ drogon_ctl create model //create model classes in model_path - #### View creation -<<<<<<< HEAD + The `dg_ctl create view` command is used to generate source files from csp files, see the [View](/ENG/ENG-07-View) section. In general, this command does not need to be used directly. It is better practice to configure the cmake file to executed this command automatically. The command example is as follows, assuming the csp file is `UsersList.csp`. ======= The `dg_ctl create view` command is used to generate source files from csp files, see the [View](/ENG/ENG-07-View) section. In general, this command does not need to be used directly. It is better practice to configure the cmake file to executed this command automatically. The command example is as follows, assuming the csp file is `UsersList.csp`. ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + ```shell dg_ctl create view UsersList.csp @@ -103,11 +99,11 @@ drogon_ctl create model //create model classes in model_path - #### Filter creation -<<<<<<< HEAD + The `dg_ctl create filter` command is used to help the user create the source files for filters, see the [Middleware and Filter](/ENG/ENG-06-Middleware-and-Filter) section. ======= The `dg_ctl create filter` command is used to help the user create the source files for filters, see the [Middleware and Filter](/ENG/ENG-06-Middleware-and-Filter) section. ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + ```shell dg_ctl create filter LoginFilter @@ -163,11 +159,11 @@ drogon_ctl create model //create model classes in model_path #include "models/User.h" ``` -<<<<<<< HEAD + Note that the models directory name is included to distinguish between multiple data sources in the same project. See [ORM](/ENG/ENG-08-3-Database-ORM). ======= Note that the models directory name is included to distinguish between multiple data sources in the same project. See [ORM](/ENG/ENG-08-3-Database-ORM). ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + ### Stress Testing @@ -185,8 +181,5 @@ dg_ctl press -n1000000 -t4 -c1000 -q http://localhost:8080/ dg_ctl press -n 1000000 -t 4 -c 1000 https://www.domain.com/path/to/be/tested ``` -<<<<<<< HEAD -# Next: [Controller Introduction](/ENG/ENG-05-0-Controller-Introduction) -======= -# Next: [Controller Introduction](/ENG/ENG-05-0-Controller-Introduction) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# Next: [Controller Introduction](/ENG/ENG-05-0-Controller-Introduction) \ No newline at end of file diff --git a/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md b/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md index 18d3835..35561a8 100644 --- a/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md +++ b/ENG/ENG-13-AOP-Aspect-Oriented-Programming.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-12-AOP面向切面编程) -======= -##### Other languages: [简体中文](/CHN/CHN-12-AOP面向切面编程) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 AOP(Aspect Oriented Programming) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns(Quoted from Wikipedia). @@ -34,8 +30,5 @@ The following figure shows the location of the above four joinpoints in the HTTP ![](images/AOP.png) -<<<<<<< HEAD -# 13 [Benchmarks](/ENG/ENG-13-Benchmarks) -======= -# 13 [Benchmarks](/ENG/ENG-13-Benchmarks) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# 13 [Benchmarks](/ENG/ENG-13-Benchmarks) \ No newline at end of file diff --git a/ENG/ENG-14-Benchmarks.md b/ENG/ENG-14-Benchmarks.md index e07f9d0..6c38382 100644 --- a/ENG/ENG-14-Benchmarks.md +++ b/ENG/ENG-14-Benchmarks.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-13-性能测试) -======= -##### Other languages: [简体中文](/CHN/CHN-13-性能测试) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 As a C++ Http application framework, performance should be one of the focus of attention. This section introduces Drogon's simple tests and achievements; @@ -51,8 +47,5 @@ The image below is a screenshot of a test: ![Test Result](images/benchmark.png) -<<<<<<< HEAD -# 14 [Causal profiling with coz](/ENG/ENG-14-Coz) -======= -# 14 [Causal profiling with coz](/ENG/ENG-14-Coz) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# 14 [Causal profiling with coz](/ENG/ENG-14-Coz) \ No newline at end of file diff --git a/ENG/ENG-15-Coz.md b/ENG/ENG-15-Coz.md index d291659..c9ee89b 100644 --- a/ENG/ENG-15-Coz.md +++ b/ENG/ENG-15-Coz.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-14-Coz分析) -======= -##### Other languages: [简体中文](/CHN/CHN-14-Coz分析) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 ## Causal profiling with coz @@ -27,8 +23,5 @@ For more information checkout: * [Git repo](https://github.com/plasma-umass/coz) * [Coz whitepaper](https://arxiv.org/pdf/1608.03676v1.pdf) -<<<<<<< HEAD -# 15 [Brotli compression](/ENG/ENG-15-Brotli) -======= -# 15 [Brotli compression](/ENG/ENG-15-Brotli) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# 15 [Brotli compression](/ENG/ENG-15-Brotli) \ No newline at end of file diff --git a/ENG/ENG-16-Brotli.md b/ENG/ENG-16-Brotli.md index 5e54901..7345c06 100644 --- a/ENG/ENG-16-Brotli.md +++ b/ENG/ENG-16-Brotli.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-15-Brotli压缩) -======= -##### Other languages: [简体中文](/CHN/CHN-15-Brotli压缩) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 ## Brotli Info @@ -17,8 +13,5 @@ if you want to dynamically compress with brotli you'll have to set `use_brotli` Users who don't intend to use brotli static, might want to get rid of brotli extra 'sibling check' by setting `br_static` to `false` in `config.json`. -<<<<<<< HEAD -# 16 [Coroutines](/ENG/ENG-16-Coroutines) -======= -# 16 [Coroutines](/ENG/ENG-16-Coroutines) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# 16 [Coroutines](/ENG/ENG-16-Coroutines) \ No newline at end of file diff --git a/ENG/ENG-17-Coroutines.md b/ENG/ENG-17-Coroutines.md index 7f33cd8..530ef17 100644 --- a/ENG/ENG-17-Coroutines.md +++ b/ENG/ENG-17-Coroutines.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-16-协程) -======= -##### Other languages: [简体中文](/CHN/CHN-16-协程) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 Drogon supports [C++ coroutines][1] starting from version 1.4. They provide a way to flatten the control flow of asynchronous calls, i.e. escaping the callback hell. With it, asynchronous programming becomes as easy as synchronous programming. @@ -170,8 +166,5 @@ There are some common pitfalls you may encounter when using coroutines. [1]: https://en.cppreference.com/w/cpp/language/coroutines -<<<<<<< HEAD -# 17 [Redis](/ENG/ENG-17-Redis) -======= -# 17 [Redis](/ENG/ENG-17-Redis) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# 17 [Redis](/ENG/ENG-17-Redis) \ No newline at end of file diff --git a/ENG/ENG-18-Redis.md b/ENG/ENG-18-Redis.md index 88e8108..2184510 100644 --- a/ENG/ENG-18-Redis.md +++ b/ENG/ENG-18-Redis.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-17-Redis) -======= -##### Other languages: [简体中文](/CHN/CHN-17-Redis) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 Drogon supports Redis, a very fast, in-memory data store. Which could be used as a database cache or a message broker. Like everything in Drogon, Redis connections are asynchronous. Which ensures Drogon running with very high concurrency even under heavy load. @@ -106,11 +102,11 @@ redisClient->newTransactionAsync([](const RedisTransactionPtr &transPtr) { ### Coroutines -<<<<<<< HEAD + Redis clients support coroutines. One should use the GCC 11 or a newer compiler and use `cmake -DCMAKE_CXX_FLAGS="-std=c++20"` to enable it. See the (coroutine)[/ENG/ENG-16-Coroutines] section for more information. ======= Redis clients support coroutines. One should use the GCC 11 or a newer compiler and use `cmake -DCMAKE_CXX_FLAGS="-std=c++20"` to enable it. See the (coroutine)[/ENG/ENG-16-Coroutines] section for more information. ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + ```c++ try @@ -126,8 +122,5 @@ catch(const std::exception& e) } ``` -<<<<<<< HEAD -# 18 [Testing Framework](/ENG/ENG-18-Testing-Framework) -======= -# 18 [Testing Framework](/ENG/ENG-18-Testing-Framework) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +# 18 [Testing Framework](/ENG/ENG-18-Testing-Framework) \ No newline at end of file diff --git a/ENG/ENG-19-Testing-Framework.md b/ENG/ENG-19-Testing-Framework.md index 908ec25..4436ded 100644 --- a/ENG/ENG-19-Testing-Framework.md +++ b/ENG/ENG-19-Testing-Framework.md @@ -1,8 +1,5 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-18-测试框架) -======= -##### Other languages: [简体中文](/CHN/CHN-18-测试框架) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + DrogonTest is a minimal testing framework built into drogon to enable easy asynchronous testing as well as synchronous ones. It is used for Drogon's own unittests and integration tests. But could also be used for testing applications built with Drogon. The syntax of DrogonTest is inspired by both [GTest](https://github.com/google/googletest) and [Catch2](https://github.com/catchorg/Catch2). diff --git a/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md b/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md index 0daa841..79d06a4 100644 --- a/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md +++ b/ENG/ENG-FAQ-1-Understanding-drogon-threading-model.md @@ -1,8 +1,5 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-FAQ-1-线程模型.md) -======= -##### Other languages: [简体中文](/CHN/CHN-FAQ-1-线程模型.md) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + # Understanding Drogon's threading model diff --git a/ENG/ENG-FAQ.md b/ENG/ENG-FAQ.md index e0897e0..8ee577d 100644 --- a/ENG/ENG-FAQ.md +++ b/ENG/ENG-FAQ.md @@ -1,8 +1,4 @@ -<<<<<<< HEAD ##### Other languages: [简体中文](/CHN/CHN-FAQ) -======= -##### Other languages: [简体中文](/CHN/CHN-FAQ) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 # FAQ @@ -10,8 +6,5 @@ This is a list of commonly asked questions and the answers, with some extended e ## What's drogon's threading model and best practices? -<<<<<<< HEAD -Drogon runs on a thread pool where the HTTP server threads as well as DB threads are created when `app().run()` is called. It is a sequential task based system. Thus it is recommended to always use the asynchronous APIs or coroutines when possible. See [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) for detail. -======= -Drogon runs on a thread pool where the HTTP server threads as well as DB threads are created when `app().run()` is called. It is a sequential task based system. Thus it is recommended to always use the asynchronous APIs or coroutines when possible. See [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) for detail. ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 + +Drogon runs on a thread pool where the HTTP server threads as well as DB threads are created when `app().run()` is called. It is a sequential task based system. Thus it is recommended to always use the asynchronous APIs or coroutines when possible. See [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) for detail. \ No newline at end of file diff --git a/ENG/Home.md b/ENG/Home.md index 933bd01..1830755 100644 --- a/ENG/Home.md +++ b/ENG/Home.md @@ -1,6 +1,6 @@ [English](Home) | [简体中文](Home.zh-CN) -<<<<<<< HEAD + ### [Welcome to the drogon wiki!](/ENG/ENG-01-Overview) * [Overview](/ENG/ENG-01-Overview) * [Install drogon](/ENG/ENG-02-Installation) @@ -154,6 +154,6 @@ * [Testing Framework](/ENG/ENG-18-Testing-Framework) * [FAQ](/ENG/ENG-FAQ) * [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) ->>>>>>> 557192c59e37288b16a0d6dd1d9116101f5a08e1 -### To contribute to the wiki, please visit the [drogon-docs](https://github.com/drogonframework/drogon-docs) repository. + +### To contribute to the wiki, please visit the [drogon-docs](https://github.com/drogonframework/drogon-docs) repository. \ No newline at end of file From 742a68ba133da015a17aed9207329bfefdead898 Mon Sep 17 00:00:00 2001 From: Chuck <32836622+chuckn408@users.noreply.github.com> Date: Mon, 1 Jul 2024 12:54:48 -0700 Subject: [PATCH 7/7] Update Home.md --- ENG/Home.md | 80 +---------------------------------------------------- 1 file changed, 1 insertion(+), 79 deletions(-) diff --git a/ENG/Home.md b/ENG/Home.md index 1830755..9cae288 100644 --- a/ENG/Home.md +++ b/ENG/Home.md @@ -1,83 +1,5 @@ [English](Home) | [简体中文](Home.zh-CN) - -### [Welcome to the drogon wiki!](/ENG/ENG-01-Overview) -* [Overview](/ENG/ENG-01-Overview) -* [Install drogon](/ENG/ENG-02-Installation) - * [System Requirements](/ENG/ENG-02-Installation#System-Requirements) - * [Library Dependencies](/ENG/ENG-02-Installation#Library-Dependencies) - * [System Preparation Examples](/ENG/ENG-02-Installation#System-Preparation-Examples) - * [Ubuntu](/ENG/ENG-02-Installation#Ubuntu-1804) - * [CentOS](/ENG/ENG-02-Installation#CentOS-75) - * [MacOS](/ENG/ENG-02-Installation#MacOS-122) - * [Windows](/ENG/ENG-02-Installation#Windows) - * [Database Environment](/ENG/ENG-02-Installation#Database-Environment) - * [PostgreSQL](/ENG/ENG-02-Installation#PostgreSQL) - * [MySQL](/ENG/ENG-02-Installation#MySQL) - * [SQLite3](/ENG/ENG-02-Installation#SQLite3) - * [Redis](/ENG/ENG-02-Installation#Redis) - * [Drogon Installation](/ENG/ENG-02-Installation#Drogon-Installation) - * [Install by source in Linux](/ENG/ENG-02-Installation#Install-by-source-in-Linux) - * [Install by source in Windows](/ENG/ENG-02-Installation#Install-by-source-in-Windows) - * [Install by vcpkg in Windows](/ENG/ENG-02-Installation#Install-by-vcpkg-in-Windows) - * [Use Docker Image](/ENG/ENG-02-Installation#Use-Docker-Image) - * [Use Nix Package](/ENG/ENG-02-Installation#Use-Nix-Package) - * [Use CPM.cmake](/CHN/CHN/CHN-02-安装#Use-CPM.cmake) - * [Include drogon source code locally](/ENG/ENG-02-Installation#Include-drogon-source-code-locally) -* [Quick Start](/ENG/ENG-03-Quick-Start) - * [Static Site](/ENG/ENG-03-Quick-Start#Static-Site) - * [Dynamic Site](/ENG/ENG-03-Quick-Start#Dynamic-Site) -* [Controller](/ENG/ENG-04-0-Controller-Introduction) - * [HttpSimpleController](/ENG/ENG-04-1-Controller-HttpSimpleController) - * [HttpController](/ENG/ENG-04-2-Controller-HttpController) - * [Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Path-Mapping) - * [Parameter Mapping](/ENG/ENG-04-2-Controller-HttpController#Parameter-Mapping) - * [Multiple Path Mapping](/ENG/ENG-04-2-Controller-HttpController#Multiple-Path-Mapping) - * [Regular Expressions Mapping](/ENG/ENG-04-2-Controller-HttpController#Regular-Expressions-Mapping) - * [WebSocketController](/ENG/ENG-04-3-Controller-WebSocketController) - * [Path Mapping](/ENG/ENG-04-3-Controller-WebSocketController#Path-Mapping) - * [Interface](/ENG/ENG-04-3-Controller-WebSocketController#Interface) -* [Middleware and Filter](/ENG/ENG-05-Middleware-and-Filter) - * [Build-in Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Built-in-Middleware/Filter) - * [Custom Middleware/Filter](/ENG/ENG-05-Middleware-and-Filter#Custom-Middleware/Filter) -* [View](/ENG/ENG-06-View) - * [Drogon's CSP](/ENG/ENG-06-View#Drogon's-CSP) - * [Automated processing of csp files](/ENG/ENG-06-View#Automated-processing-of-csp-files) - * [Dynamic compilation and loading of views](/ENG/ENG-06-View#Dynamic-compilation-and-loading-of-views) -* [Session](/ENG/ENG-07-Session) -* [Database](/ENG/ENG-08-0-Database-General) - * [DbClient](/ENG/ENG-08-1-Database-DbClient) - * [Execution Interface](/ENG/ENG-08-1-Database-DbClient#Execution-Interface) - * [execSqlAsync](/ENG/ENG-08-1-Database-DbClient#execSqlAsync) - * [execSqlAsyncFuture](/ENG/ENG-08-1-Database-DbClient#execSqlAsyncFuture) - * [execSqlSync](/ENG/ENG-08-1-Database-DbClient#execSqlSync) - * [operator<<](/ENG/ENG-08-1-Database-DbClient#operator<<) - * [Transaction](/ENG/ENG-08-2-Database-Transaction) - * [ORM](/ENG/ENG-08-3-Database-ORM) - * [Model Class Interface](/ENG/ENG-08-3-Database-ORM#Model-Class-Interface) - * [Mapper Class Template](/ENG/ENG-08-3-Database-ORM#Mapper-Class-Template) - * [Criteria](/CHN/CHN/CHN-08-3-Database-ORM#Criteria) - * [Mapper's Chain Interface](/CHN/CHN/CHN-08-3-Database-ORM#Mapper's-Chain-Interface) - * [Convert](/CHN/CHN/CHN-08-3-Database-ORM#Convert) - * [Relationships](/CHN/CHN/CHN-08-3-Database-ORM#Relationships) - * [has one](/CHN/CHN/CHN-08-3-Database-ORM#has-one) - * [has many](/CHN/CHN/CHN-08-3-Database-ORM#has-many) - * [many to many](/CHN/CHN/CHN-08-3-Database-ORM#many-to-many) - * [FastDbClient](/ENG/ENG-08-4-Database-FastDbClient) - * [Automatic batch mode](/ENG/ENG-08-5-Database-auto_batch) -* [Plugins](/ENG/ENG-09-Plugins) -* [Configuration File](/ENG/ENG-10-Configuration-File) -* [drogon_ctl Command](/ENG/ENG-11-drogon_ctl-Command) -* [AOP](/ENG/ENG-12-AOP-Aspect-Oriented-Programming) -* [Benchmarks](/ENG/ENG-13-Benchmarks) -* [Coz profiling](/ENG/ENG-14-Coz) -* [Brotli info](/ENG/ENG-15-Brotli) -* [Coroutines](/ENG/ENG-16-Coroutines) -* [Redis](/ENG/ENG-17-Redis) -* [Testing Framework](/ENG/ENG-18-Testing-Framework) -* [FAQ](/ENG/ENG-FAQ) - * [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) -======= ### [Welcome to the drogon wiki!](/ENG/ENG-01-Overview) * [Overview](/ENG/ENG-01-Overview) * [Install drogon](/ENG/ENG-02-Installation) @@ -156,4 +78,4 @@ * [Understanding drogon's threading model](/ENG/ENG-FAQ-1-Understanding-drogon-threading-model) -### To contribute to the wiki, please visit the [drogon-docs](https://github.com/drogonframework/drogon-docs) repository. \ No newline at end of file +### To contribute to the wiki, please visit the [drogon-docs](https://github.com/drogonframework/drogon-docs) repository.