Skip to content

Commit d1f5765

Browse files
committed
chore: add some tips
1 parent ebadf79 commit d1f5765

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

docs/core/event_handler/api_gateway.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,10 @@ there might be cases where you have some shared routes for multiple lambdas like
860860
to be used with Application Load Balancer.
861861

862862
Below is an example project layout for AWS Lambda Functions using AWS SAM CLI that allows for relative path
863-
imports (ie: `from .routers import health` ).
863+
imports (ie: `from .routers import health`).
864+
865+
!!! tip "See in `src/app/main.py`, when including a route we can add a prefix to those routes ie: `prefix="/health"`."
866+
!!! tip "See in `src/app/routers/health.py`, when adding a child logger we use `Logger(child=True)`."
864867

865868
=== "Project layout"
866869

@@ -977,16 +980,19 @@ imports (ie: `from .routers import health` ).
977980

978981
=== "src/app/routers/health.py"
979982

980-
```python hl_lines="3 5 8"
983+
```python hl_lines="4 6-7 10 12"
981984
from typing import Dict
982985

986+
from aws_lambda_powertools import Logger
983987
from aws_lambda_powertools.event_handler.api_gateway import Router
984988

989+
logger = Logger(child=True)
985990
router = Router()
986991

987992

988993
@router.get("/status")
989994
def health() -> Dict:
995+
logger.debug("Health check called")
990996
return {"status": "OK"}
991997
```
992998

0 commit comments

Comments
 (0)