File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 3
3
// Noze.io / Macro
4
4
//
5
5
// Created by Helge Heß on 6/2/16.
6
- // Copyright © 2016-2020 ZeeZide GmbH. All rights reserved.
6
+ // Copyright © 2016-2025 ZeeZide GmbH. All rights reserved.
7
7
//
8
8
9
9
import enum NIOHTTP1. HTTPMethod
@@ -21,10 +21,11 @@ private let debugMatcher = process.getenvflag("macro.router.matcher.debug")
21
21
private let debugWalker = process. getenvflag ( " macro.router.walker.debug " )
22
22
23
23
/**
24
- * A Route is a middleware which wraps another middleware and guards it by a
24
+ * A `` Route`` is a middleware which wraps another middleware and guards it by a
25
25
* condition. For example:
26
- *
27
- * app.get("/index") { req, res, next in ... }
26
+ * ```swift
27
+ * app.get("/index") { req, res, next in ... }
28
+ * ```
28
29
*
29
30
* This creates a Route wrapping the closure given. It only runs the
30
31
* embedded closure if:
@@ -45,8 +46,14 @@ private let debugWalker = process.getenvflag("macro.router.walker.debug")
45
46
* - otherwise the text is matched AS IS
46
47
*
47
48
* Variables can be extracted using:
48
- *
49
- * req.params[int: "id"]
49
+ * ```swift
50
+ * app.get("/user/:id/view") { req, res in
51
+ * guard let id = req.params[int: "id"] else {
52
+ * return res.sendStatus(404) // TBD: or 400?
53
+ * }
54
+ * ...
55
+ * }
56
+ * ```
50
57
*
51
58
* and companions.
52
59
*/
You can’t perform that action at this time.
0 commit comments