Skip to content

Commit ce352b3

Browse files
committed
misc: update README
1 parent 25bba89 commit ce352b3

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Simple HTTP adapter for AWS Lambda
2121
package main
2222

2323
import (
24-
"github.com/its-felix/aws-lambda-go-http-adapter/adapter/vanilla"
24+
"github.com/its-felix/aws-lambda-go-http-adapter/adapter"
2525
"net/http"
2626
)
2727

@@ -32,7 +32,7 @@ func main() {
3232
_, _ = w.Write([]byte("pong"))
3333
})
3434

35-
adapter := vanilla.NewAdapter(mux)
35+
adapter := adapter.NewVanillaAdapter(mux)
3636
}
3737
```
3838

@@ -42,7 +42,7 @@ package main
4242

4343
import (
4444
"github.com/labstack/echo/v4"
45-
echoadapter "github.com/its-felix/aws-lambda-go-http-adapter/adapter/echo"
45+
"github.com/its-felix/aws-lambda-go-http-adapter/adapter"
4646
"net/http"
4747
)
4848

@@ -52,7 +52,7 @@ func main() {
5252
return c.String(200, "pong")
5353
})
5454

55-
adapter := echoadapter.NewAdapter(e)
55+
adapter := adapter.NewEchoAdapter(e)
5656
}
5757
```
5858

@@ -62,8 +62,7 @@ package main
6262

6363
import (
6464
"github.com/gofiber/fiber/v2"
65-
fiberadapter "github.com/its-felix/aws-lambda-go-http-adapter/adapter/fiber"
66-
"net/http"
65+
"github.com/its-felix/aws-lambda-go-http-adapter/adapter"
6766
)
6867

6968
func main() {
@@ -72,7 +71,7 @@ func main() {
7271
return ctx.SendString("pong")
7372
})
7473

75-
adapter := fiberadapter.NewAdapter(app)
74+
adapter := adapter.NewFiberAdapter(app)
7675
}
7776
```
7877

@@ -129,6 +128,7 @@ func main() {
129128
```
130129

131130
#### Lambda Function URL (streaming)
131+
(read the additional notes about streaming below)
132132
```golang
133133
package main
134134

@@ -153,13 +153,13 @@ package main
153153
import (
154154
"github.com/aws/aws-lambda-go/events"
155155
"github.com/gofiber/fiber/v2"
156-
fiberadapter "github.com/its-felix/aws-lambda-go-http-adapter/adapter/fiber"
156+
"github.com/its-felix/aws-lambda-go-http-adapter/adapter"
157157
)
158158

159159
func main() {
160160
app := fiber.New()
161161
app.Get("/ping", func(ctx *fiber.Ctx) error {
162-
event := fiberadapter.GetSourceEvent(ctx)
162+
event := adapter.GetSourceEventFiber(ctx)
163163
switch event := event.(type) {
164164
case events.APIGatewayProxyRequest:
165165
// do something
@@ -238,9 +238,9 @@ Have a look at the existing event handlers:
238238

239239
## Extending for other frameworks
240240
Have a look at the existing adapters:
241-
- [net/http](./adapter/vanilla/vanilla.go)
242-
- [Echo](./adapter/echo/echo.go)
243-
- [Fiber](./adapter/fiber/fiber.go)
241+
- [net/http](./adapter/vanilla.go)
242+
- [Echo](./adapter/echo.go)
243+
- [Fiber](./adapter/fiber.go)
244244

245245
## Build Tags
246246
You can opt-in to enable partial build by using the build-tag `lambdahttpadapter.partial`.
@@ -254,4 +254,10 @@ Once this build-tag is present, the following build-tags are available:
254254
- `lambdahttpadapter.functionurl` (enables Lambda Function URL handler)
255255

256256
Also note that Lambda Function URL in Streaming-Mode requires the following build-tag to be set:
257-
- `lambda.norpc`
257+
- `lambda.norpc`
258+
259+
## Note about Lambda streaming
260+
Response streaming is currently not supported for the fiber adapter.
261+
The code will work, but the response body will only be sent downstream as soon as the request was processed completely.
262+
263+
This is because there seems to be no way in `fasthttp` to provide a `io.Writer` to be populated while the request is being processed.

0 commit comments

Comments
 (0)