Gateway

Drop-in replacement for Go net/http when running in AWS Lambda & API Gateway
Alternatives To Gateway
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Serverless44,4791,61883015 hours ago1,987September 19, 20221,002mitJavaScript
⚡ Serverless Framework – Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more! –
Sst12,9104a day ago681September 23, 2022623mitJavaScript
💥 SST makes it easy to build full-stack serverless apps.
Awesome Aws11,283
24 days ago1December 21, 201563otherPython
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.
Examples10,762
4 days ago19April 25, 2021167otherJavaScript
Serverless Examples – A collection of boilerplates and examples of serverless architectures built with the Serverless Framework on AWS Lambda, Microsoft Azure, Google Cloud Functions, and more.
Chalice9,5971263123 days ago86June 01, 2022430apache-2.0Python
Python Serverless Microframework for AWS
Serverless Application Model8,96584152 days ago59June 07, 2022132apache-2.0Python
The AWS Serverless Application Model (AWS SAM) transform is a AWS CloudFormation macro that transforms SAM templates into CloudFormation templates.
Up8,6876813a month ago11March 02, 2018291mitGo
Deploy infinitely scalable serverless apps, apis, and sites in seconds to AWS.
Webiny Js6,47711314 hours ago251September 07, 2022216otherTypeScript
Open-source serverless enterprise CMS. Includes a headless CMS, page builder, form builder, and file manager. Easy to customize and expand. Deploys to AWS.
Aws Sam Cli6,249311215 hours ago129June 29, 2022358apache-2.0Python
CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
Docker Lambda5,85238143 months ago15June 30, 201868mitC#
Docker images and test runners that replicate the live AWS Lambda environment
Alternatives To Gateway
Select To Compare


Alternative Project Comparisons
Readme

Package gateway provides a drop-in replacement for net/http's ListenAndServe for use in AWS Lambda & API Gateway, simply swap it out for gateway.ListenAndServe. Extracted from Up which provides additional middleware features and operational functionality.

There are two versions of this library, version 1.x supports AWS API Gateway 1.0 events used by the original REST APIs, and 2.x which supports 2.0 events used by the HTTP APIs. For more information on the options read Choosing between HTTP APIs and REST APIs on the AWS documentation website.

Installation

To install version 1.x for REST APIs.

go get github.com/apex/gateway

To install version 2.x for HTTP APIs.

go get github.com/apex/gateway/v2

Example

package main

import (
	"fmt"
	"log"
	"net/http"
	"os"

	"github.com/apex/gateway"
)

func main() {
	http.HandleFunc("/", hello)
	log.Fatal(gateway.ListenAndServe(":3000", nil))
}

func hello(w http.ResponseWriter, r *http.Request) {
	// example retrieving values from the api gateway proxy request context.
	requestContext, ok := gateway.RequestContext(r.Context())
	if !ok || requestContext.Authorizer["sub"] == nil {
		fmt.Fprint(w, "Hello World from Go")
		return
	}

	userID := requestContext.Authorizer["sub"].(string)
	fmt.Fprintf(w, "Hello %s from Go", userID)
}

GoDoc

Popular Lambda Functions Projects
Popular Amazon Web Services Projects
Popular Cloud Computing Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Golang
Go
Aws
Http
Lambda
Gateway
Serverless
Aws Lambda