lambdahttp

package module
v0.0.0-...-38ef359 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 8 Imported by: 0

README

lambdahttp

A simple Go library that wraps aws-lambda-go to use an interface more faithful to the net/http standard. This makes it easier to set cookies, use redirects, and generally plays more likely with the vast number of Go libraries that work with HTTP.

Usage

package main

import (
	"context"
	"fmt"
	"net/http"

	"gitlab.com/jD91mZM2/lambdahttp"
)

func handler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "Hello, World")
}

func main() {
	lambdahttp.Start(handler)
}

See the example/ directory for a working example using this library. You can deploy it easily via:

  • aws configure to log in
  • terraform init to initialise modules
  • terraform apply to deploy or update your function

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(f func(ctx context.Context, w http.ResponseWriter, r *http.Request))

Wraps `lambda.Start`, but instead of taking `events.APIGatewayV2HTTPRequest` the function takes `http.Request`.

func WrapFunction

Wrap a lambda handler function. It will make the function input `http.ResponseWriter` and `http.Request` instead of `events.APIGatewayV2HTTPRequest`. You might be better off using lambdahttp.Start instead, which uses this function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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