Skip to content
/ wrap Public

A very simple wrapper to wrap your GoLang Echo API's into Lambda/API Gateway

Notifications You must be signed in to change notification settings

vdparikh/wrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wrap

A very simple wrapper to wrap your Labstack Echo API's into Lambda/API Gateway

Installation

go get -u github.com/vdparikh/wrap
go mod vendor

Usage

Check out example/example.go for usage.

package main

import (
	"github.com/aws/aws-lambda-go/lambda"
	"github.com/labstack/echo"
	"github.com/labstack/echo/middleware"
	"github.com/vdparikh/wrap"
)

func main() {
	e := echo.New()

	e.Use(middleware.Logger())

	e.GET("/hello", func(c echo.Context) error {
		return c.JSON(200, "HELLO")
	})

	server := wrap.Route(e)

	lambda.Start(server)
}

Run sample

To run this locally as SAM (Serverless Application Model), then you need to install SAM CLI. SAM is an easier way to test out your serverless functions without having to deploy them first.

cd example
# Build Binary
GOARCH=amd64 GOOS=linux go build -ldflags="-s -w" -o hello .

# Start SAM
sam local start-api

On another terminal execute the API and you should see the HELLO response

curl -v http://localhost:3000/hello

About

A very simple wrapper to wrap your GoLang Echo API's into Lambda/API Gateway

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages