apig

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 10 Imported by: 0

README

apig

Use Go http.Handler in AWS Lambdas with Lambda function URLs enabled, or running as an AWS API Gateway HTTP API target.

Documentation

Overview

Package apig provides an adapter enabling use of http.Handler inside AWS Lambda running as AWS API Gateway HTTP API target. It also supports Lambda Function URLs.

For more context see https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html and https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html

Usage example:

package main

import (
    "net/http"

    "github.com/artyom/apig"
    "github.com/aws/aws-lambda-go/lambda"
)

func main() {
    lambda.Start(apig.Handler(http.HandlerFunc(hello)))
}

func hello(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Hello, world!\n"))
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

Handler returns function suitable to use as an AWS Lambda handler with github.com/aws/aws-lambda-go/lambda package.

Note that both request and response are fully cached in memory.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL