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
{{ message }}
This repository was archived by the owner on Aug 6, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,10 @@ $ go get github.com/aws/aws-lambda-go/events
10
10
$ go get github.com/aws/aws-lambda-go/lambda
11
11
12
12
# Next, we install the core library
13
-
$ go get github.com/awslabs/aws-lambda-go-api-proxy
13
+
$ go get github.com/awslabs/aws-lambda-go-api-proxy/...
14
14
```
15
15
16
-
Following the instructions from the [Lambda documentation](https://docs.aws.amazon.com/lambda/latest/dg/go-programming-model-handler-types.html), we need to declare a `Handler` method for our main package. We will declare a `ginlambda.GinLambda` object
16
+
Following the instructions from the [Lambda documentation](https://docs.aws.amazon.com/lambda/latest/dg/go-programming-model-handler-types.html), we need to declare a `Handler` method for our main package. We will declare a `ginadapter.GinLambda` object
17
17
in the global scope, initialized once it in the Handler with all its API methods, and then use the `Proxy` method to translate requests and responses
18
18
19
19
```go
@@ -56,6 +56,9 @@ func main() {
56
56
}
57
57
```
58
58
59
+
## Other frameworks
60
+
This package also supports [Negroni](https://github.com/urfave/negroni), [GorillaMux](https://github.com/gorilla/mux), and plain old `HandlerFunc` - take a look at the code in their respective sub-directories. All packages implement the `Proxy` method exactly like our Gin sample above.
61
+
59
62
## Deploying the sample
60
63
We have included a [SAM template](https://github.com/awslabs/serverless-application-model) with our sample application. You can use the [AWS CLI](https://aws.amazon.com/cli/) to quickly deploy the application in your AWS account.
The `aws-lambda-go-api-proxy` library includes two package: `ginlambda` and`core`. The `ginlambda`package contains the [Gin](https://gin-gonic.github.io/gin/)-specific implementation of the library. The `core` package, contains utility methods and interfaces to translate API Gateway proxy events into Go's default `http.Request` and `http.ResponseWriter` objects.
100
+
The `aws-lambda-go-api-proxy`, alongside the various adapters, declares a`core`package. The `core` package, contains utility methods and interfaces to translate API Gateway proxy events into Go's default `http.Request` and `http.ResponseWriter` objects.
98
101
99
-
You can see that the [`ginlambda.go`](gin/ginlambda.go) file extends the `RequestAccesor` struct defined in the [`request.go`](core/request.go) file. `RequestAccessor` gives you access to the `ProxyEventToHTTPRequest()` method.
102
+
You can see that the [`ginlambda.go`](gin/adapter.go) file extends the `RequestAccesor` struct defined in the [`request.go`](core/request.go) file. `RequestAccessor` gives you access to the `ProxyEventToHTTPRequest()` method.
100
103
101
104
The `GinLambda` object is initialized with an instance of `gin.Engine`. `gin.Engine` implements methods defined in the `http.Handler` interface.
0 commit comments