Skip to content

Instantly share code, notes, and snippets.

APIGWRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- apigateway.amazonaws.com
Parameters:
TableName:
Type: String
Description: Form data table name
Resources:
FormDataTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
Parameters:
FrontendBucketName:
Description: Bucket name where to upload frontend static files
Type: String
Resources:
FrontendS3:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref FrontendBucketName
package main
import(
"fmt"
"strings"
"github.com/antklim/tuples"
)
func main() {
package main
import(
"fmt"
"strings"
"github.com/antklim/tuples"
)
func main() {
package main
import(
"fmt"
"github.com/antklim/tuples"
)
type format struct {
Height int `tuples:"h"`
{
"loggedIn":true,
"data":[
{"circuitId":"albert_park","url":"http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit","circuitName":"Albert Park Grand Prix Circuit","Location":{"lat":"-37.8497","long":"144.968","locality":"Melbourne","country":"Australia"}},
{"circuitId":"americas","url":"http://en.wikipedia.org/wiki/Circuit_of_the_Americas","circuitName":"Circuit of the Americas","Location":{"lat":"30.1328","long":"-97.6411","locality":"Austin","country":"USA"}},
{"circuitId":"bahrain","url":"http://en.wikipedia.org/wiki/Bahrain_International_Circuit","circuitName":"Bahrain International Circuit","Location":{"lat":"26.0325","long":"50.5106","locality":"Sakhir","country":"Bahrain"}},
{"circuitId":"BAK","url":"http://en.wikipedia.org/wiki/Baku_City_Circuit","circuitName":"Baku City Circuit","Location":{"lat":"40.3725","long":"49.8533","locality":"Baku","country":"Azerbaijan"}},
{"circuitId":"catalunya","url":"http://en.wikipedia.org/wiki/Circuit_de_Barcelona-Catalunya","circuitName":
#!/bin/bash
################################################################################
##
## The following script synchronises frontend resources with AWS S3 bucket
##
################################################################################
if [ -z $FRONTEND_BUCKET_NAME ] ; then
echo "error: FRONTEND_BUCKET_NAME required"
const formSubmitResult = document.getElementById('formSubmitResult')
const intentionForm = document.getElementById('intentionForm')
function alert(message, type) {
const wrapper = document.createElement('div')
wrapper.innerHTML = '<div class="alert alert-' + type + ' alert-dismissible" role="alert">' + message + '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div>'
formSubmitResult.append(wrapper)
}
function onIntentionSubmit(event) {
<body>
<h1 class="display-2">Welcome to Serverless Form!</h1>
<div id="formSubmitResult"></div>
<form id="intentionForm">
<fieldset>
<!-- Input fields omitted ... -->
<button type="submit"
class="btn btn-primary"