mu

package module
v0.0.0-...-1c53bf7 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: MIT Imports: 9 Imported by: 2

README

mu

mu is an AWS Lambda helper that allows for re-purposing HTTP API projects quickly into lambdas.

Example

import (
	"net/http"

	"github.com/ModelRocket/mu"
	"github.com/gorilla/mux"
)

func productHandler(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusOK)
}

func main() {
	r := mux.NewRouter()

	r.HandleFunc("/products/{key}", productHandler)

	mu.Start(r)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(event events.APIGatewayProxyRequest) (request *http.Request, err error)

NewRequest returns a new *http.Request for the APIGatewayProxyRequest event

func Start

func Start(handler http.Handler) error

Types

type Response

type Response struct {
	events.APIGatewayProxyResponse
	// contains filtered or unexported fields
}

Response defines a struct that conforms to the API Gateway Labmbda Response

func NewResponse

func NewResponse() *Response

NewResponse returns a new response object

func (*Response) Header

func (r *Response) Header() http.Header

Header implements the http.ResponseWriter.Header() method

func (*Response) Write

func (r *Response) Write(body []byte) (int, error)

Write implements the http.ResponseWriter.Write() method

func (*Response) WriteHeader

func (r *Response) WriteHeader(statusCode int)

WriteHeader implements the http.ResponseWriter.WriteHeader() method

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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