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 33// Noze.io / Macro
44//
55// 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.
77//
88
99import enum NIOHTTP1. HTTPMethod
@@ -21,10 +21,11 @@ private let debugMatcher = process.getenvflag("macro.router.matcher.debug")
2121private let debugWalker = process. getenvflag ( " macro.router.walker.debug " )
2222
2323/**
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
2525 * condition. For example:
26- *
27- * app.get("/index") { req, res, next in ... }
26+ * ```swift
27+ * app.get("/index") { req, res, next in ... }
28+ * ```
2829 *
2930 * This creates a Route wrapping the closure given. It only runs the
3031 * embedded closure if:
@@ -45,8 +46,14 @@ private let debugWalker = process.getenvflag("macro.router.walker.debug")
4546 * - otherwise the text is matched AS IS
4647 *
4748 * 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+ * ```
5057 *
5158 * and companions.
5259 */
You can’t perform that action at this time.
0 commit comments