Skip to content

Instantly share code, notes, and snippets.

@mweagle mweagle/application.go
Last active Apr 11, 2016

Embed
What would you like to do?
Hello world for Medium
// File: application.go
package main
import (
"encoding/json"
"fmt"
"net/http"
"github.com/Sirupsen/logrus"
sparta "github.com/mweagle/Sparta"
)
////////////////////////////////////////////////////////////////////////////////
// Hello world event handler
//
func helloWorld(event *json.RawMessage,
context *sparta.LambdaContext,
w http.ResponseWriter,
logger *logrus.Logger) {
logger.Info("Hello World: ", string(*event))
fmt.Fprint(w, string(*event))
}
////////////////////////////////////////////////////////////////////////////////
// Main
func main() {
var lambdaFunctions []*sparta.LambdaAWSInfo
lambdaFn := sparta.NewLambda(sparta.IAMRoleDefinition{}, helloWorld, nil)
lambdaFunctions = append(lambdaFunctions, lambdaFn)
// Deploy it
sparta.Main("SpartaHelloWorld",
"Simple Sparta application that creates a single AWS Lambda function",
lambdaFunctions,
nil,
nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.