Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rodkranz/routing

Stupid Routing for AWS Lambdas :)
https://github.com/rodkranz/routing

Last synced: 5 days ago
JSON representation

Stupid Routing for AWS Lambdas :)

Awesome Lists containing this project

README

        

Router
---

Example:

```go
package main

import (
"net/http"

"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/rodkranz/routing"
)

const (
hello = "/hello"
)

func main() {
r := routing.New()

r.Register(http.MethodGet, hello, HandlerHelloWord)

lambda.Start(r.Lambda)
}

func HandlerHelloWord(context routing.Context, proxy routing.RequestProxy) (i interface{}, e error) {
return events.APIGatewayProxyResponse{
StatusCode: http.StatusOK,
Body: string("Hello world"),
}, nil
}

```