|
1 | 1 | # lambdarouter |
2 | | -[](https://godoc.org/github.com/mitchelljfs/lambdarouter) |
| 2 | +[](https://godoc.org/github.com/mitchell/lambdarouter) |
3 | 3 | [](https://travis-ci.org/mitchell/lambdarouter) |
4 | 4 | [](https://codeclimate.com/github/mitchelljfs/lambdarouter/test_coverage) |
5 | 5 | [](https://codeclimate.com/github/mitchelljfs/lambdarouter/maintainability) |
6 | | -[](https://goreportcard.com/report/github.com/mitchelljfs/lambdarouter) |
| 6 | +[](https://goreportcard.com/report/github.com/mitchell/lambdarouter) |
7 | 7 |
|
8 | | -So far this package can create a router and routes whose execution utilizes a middleware context pattern, all in one Golang Lambda function. It has full test coverage, and is currently deployed in numerous services where I am employed. Check out the GoDoc Reference to see how to instantiate a router and create endpoints. |
| 8 | +This package contains a router capable of routing many AWS Lambda API gateway requests to anything |
| 9 | +that implements the aws-lambda-go/lambda.Handler interface, all in one Lambda function. It plays |
| 10 | +especially well with go-kit's awslambda transport package. Get started by reading below and visiting |
| 11 | +the [GoDoc reference](https://godoc.org/github.com/mitchell/lambdarouter). |
| 12 | + |
| 13 | +## Initializing a Router |
| 14 | +``` |
| 15 | +r := lambdarouter.New("prefix/") |
| 16 | +
|
| 17 | +r.Get("hello/{name}", helloHandler) |
| 18 | +r.Post("hello/server", helloHandler) |
| 19 | +r.Delete("hello", lambda.NewHandler(func() (events.APIGatewayProxyResponse, error) { |
| 20 | + return events.APIGatewayProxyResponse{ |
| 21 | + Body: "nothing to delete", |
| 22 | + }, nil |
| 23 | +})) |
| 24 | +
|
| 25 | +lambda.StartHandler(r) |
| 26 | +``` |
| 27 | + |
| 28 | +Check out the `examples/` folder for more fleshed out examples in the proper context. |
0 commit comments