Skip to content

Latest commit

 

History

History
114 lines (77 loc) · 2.56 KB

README.md

File metadata and controls

114 lines (77 loc) · 2.56 KB

GO Lambda function local development

Build GraphQL API with AWS AppSync and Lambda with Go by using SST

Go

Go

Go

An appsync-boilerplate with Go, created with SST.

Getting Started

Read the tutorial

Install the example.

npm intall

Start the Live Lambda Development environment.

npm sst start

Change the default stage and region

# Start
npx sst start --stage alpha --region us-west-1

# Build
npx sst build --stage alpha --region us-west-1

# Deploy
npx sst deploy --stage alpha --region us-west-1

# Remove
npx sst remove --stage alpha --region us-west-1

Once your local environment is ready, head over to the AppSync console.

Here you can run queries and mutations and make changes locally to test your Lambda resolvers.

mutation create {
  create(input: { id: "001", content: "My note" }) {
    id
    content
  }
}

query getOne {
  getOne(input: {id: "001"}) {
    id
    content
  }
}

query list {
  list {
    id
    content
  }
}

mutation update {
  update(input: { id: "001", content: "My updated note" }) {
    id
    content
  }
}

mutation delete {
  delete(input: {id: "001"})
}

Commands

npm run start

Starts the local Lambda development environment.

npm run build

Build your app and synthesize your stacks.

Generates a .build/ directory with the compiled files and a .build/cdk.out/ directory with the synthesized CloudFormation stacks.

npm run deploy [stack]

Deploy all your stacks to AWS. Or optionally deploy a specific stack.

npm run remove [stack]

Remove all your stacks and all of their resources from AWS. Or optionally remove a specific stack.

npm run test

Runs your tests using Jest. Takes all the Jest CLI options.

Documentation

Learn more about SST.

Community

Follow them on Twitter or post on their forums.