From 04405210c1afbdf52076206efe05465c1682e1c2 Mon Sep 17 00:00:00 2001 From: Bryce Schober Date: Wed, 30 Mar 2022 13:04:25 -0700 Subject: [PATCH] Fix indentation & numbering in middleware --- docs/guides/middleware.md | 44 ++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/docs/guides/middleware.md b/docs/guides/middleware.md index abfea9f7b..e29aa6aba 100644 --- a/docs/guides/middleware.md +++ b/docs/guides/middleware.md @@ -11,18 +11,19 @@ There are two possible signatures for before_handle 1. if you only need to access this middleware's context. -```cpp -void before_handle(request& req, response& res, context& ctx) -``` + ```cpp + void before_handle(request& req, response& res, context& ctx) + ``` 2. To get access to other middlewares context -``` cpp -template -void before_handle(request& req, response& res, context& ctx, AllContext& all_ctx) -{ - auto other_ctx = all_ctx.template get(); -} -``` + + ``` cpp + template + void before_handle(request& req, response& res, context& ctx, AllContext& all_ctx) + { + auto other_ctx = all_ctx.template get(); + } + ``` ## after_handle @@ -30,18 +31,19 @@ There are two possible signatures for after_handle 1. if you only need to access this middleware's context. -```cpp -void after_handle(request& req, response& res, context& ctx) -``` + ```cpp + void after_handle(request& req, response& res, context& ctx) + ``` 2. To get access to other middlewares context -``` cpp -template -void after_handle(request& req, response& res, context& ctx, AllContext& all_ctx) -{ - auto other_ctx = all_ctx.template get(); -} -``` + + ``` cpp + template + void after_handle(request& req, response& res, context& ctx, AllContext& all_ctx) + { + auto other_ctx = all_ctx.template get(); + } + ``` ## Using middleware @@ -91,4 +93,4 @@ struct AdminAreaGuard : crow::ILocalMiddleware void after_handle(crow::request& req, crow::response& res, context& ctx) {} }; -``` \ No newline at end of file +```