Skip to content

Instantly share code, notes, and snippets.

@mweagle
Created January 22, 2018 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mweagle/81abd4332029d63b6bb63575af60476f to your computer and use it in GitHub Desktop.
Save mweagle/81abd4332029d63b6bb63575af60476f to your computer and use it in GitHub Desktop.
// Register the function with the API Gateway
apiStage := sparta.NewStage("v1")
apiGateway := sparta.NewAPIGateway("SpartaHTML", apiStage)
// Enable CORS s.t. the S3 site can access the resources
apiGateway.CORSOptions = &sparta.CORSOptions{
Headers: map[string]interface{}{
"Access-Control-Allow-Headers": "Content-Type,X-Amz-Date,Authorization,X-Api-Key",
"Access-Control-Allow-Methods": "*",
"Access-Control-Allow-Origin": gocf.GetAtt(s3Site.CloudFormationS3ResourceName(), "WebsiteURL"),
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment