Skip to content

Commit e82a5dc

Browse files
committed
Update README.md
1 parent c3c3e3d commit e82a5dc

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export const handler: Handler = async (event, context) => {
208208

209209
return {
210210
statusCode: 200,
211-
body: "Hello World!",
211+
body: { event, context },
212212
};
213213
};
214214
```
@@ -440,8 +440,7 @@ Create `events/custom.json`:
440440

441441
```json
442442
{
443-
"user": "Alice",
444-
"action": "login"
443+
"user": "Alice"
445444
}
446445
```
447446

@@ -459,6 +458,9 @@ Create `events/api-gateway.json`:
459458
}
460459
```
461460

461+
> [!NOTE]
462+
> Lambdas can technically receive any payload, but are can also be invoked from other AWS services, so it is very useful to replicate this as much as possible.
463+
462464
### Inject the event
463465

464466
Update `docker-compose.yaml`:
@@ -480,17 +482,21 @@ services:
480482
### Test with data
481483

482484
```shell
483-
docker compose up --build --abort-on-container-exit
485+
docker compose up --abort-on-container-exit
484486
```
485487

486488
```shell
487-
LAMBDA_INPUT=@/events/custom.json docker compose up --build --abort-on-container-exit
489+
LAMBDA_INPUT=@/events/custom.json docker compose up --abort-on-container-exit
488490
```
489491

490492
```shell
491-
LAMBDA_INPUT=@/events/api-gateway.json docker compose up --build --abort-on-container-exit
493+
LAMBDA_INPUT=@/events/api-gateway.json docker compose up --abort-on-container-exit
492494
```
493495

496+
> [!NOTE]
497+
> With each of these commands, you'll notice that the `curl` container receives a slightly different response where the event changes.
498+
> The first command we didn't include the `LAMBDA_INPUT` attribute, so you `docker-compose.yaml` default the input to `{}`.
499+
494500
---
495501

496502
## 5. Optimisation

0 commit comments

Comments
 (0)