You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: refactor routing rules syntax documentation per review feedback
- Remove redundant routing rules syntax introduction section
- Update header levels from h5 to h4 for better hierarchy
- Move inline code examples to separate files in examples/event_handler_rest/src
- Add proper Lambda handlers with Logger and Tracer utilities
- Reorganize content by moving regex pattern table to Dynamic Path Parameters section
- Update tip formatting to match project style
- Simplify inline comments to follow project conventions
Copy file name to clipboardExpand all lines: docs/core/event_handler/api_gateway.md
+12-64Lines changed: 12 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -214,90 +214,38 @@ Each dynamic route you set must be part of your function signature. This allows
214
214
???+ tip
215
215
You can also nest dynamic paths, for example `/todos/<todo_id>/<todo_status>`.
216
216
217
-
#### Routing Rules Syntax
217
+
#### Dynamic Path Parameters
218
218
219
-
The routing system uses a specific syntax to define dynamic URL patterns. Understanding this syntax is crucial for creating flexible and robust API routes.
220
-
221
-
##### Dynamic Path Parameters
222
-
223
-
Dynamic path parameters are defined using angle brackets `<parameter_name>` syntax. These parameters are automatically converted to regex patterns for efficient route matching.
219
+
Dynamic path parameters are defined using angle brackets `<parameter_name>` syntax. These parameters are automatically converted to regex patterns for efficient route matching and performance gains.
224
220
225
221
**Syntax**: `/path/<parameter_name>`
226
222
227
223
***Parameter names** must contain only word characters (letters, numbers, underscore)
228
224
***Captured values** can contain letters, numbers, underscores, and these special characters: `-._~()'!*:@,;=+&$%<> \[]{}|^`
229
225
230
-
=== "routing_syntax_basic.py"
231
-
232
-
```python
233
-
from aws_lambda_powertools.event_handler import APIGatewayRestResolver
234
-
235
-
app = APIGatewayRestResolver()
236
-
237
-
@app.get("/users/<user_id>")
238
-
def get_user(user_id: str):
239
-
# user_id can be: "123", "user-456", "john.doe", "user_with_underscores"
The parameter names in your route (`<user_id>`) must exactly match the parameter names in your function signature (`user_id: str`). This is how the framework knows which captured values to pass to which parameters.
0 commit comments