Scan request

To get started, we need to implement the function responsible for returning a list of movies; the following steps describe how to achieve that:

  1. Update the findAll handler endpoint to use the Scan method to fetch all items from the table:
func findAll() (events.APIGatewayProxyResponse, error) {  cfg, err := external.LoadDefaultAWSConfig()  if err != nil {    return events.APIGatewayProxyResponse{      StatusCode: http.StatusInternalServerError,      Body: "Error while retrieving AWS credentials",    }, nil  }  svc := dynamodb.New(cfg)  req := svc.ScanRequest(&dynamodb.ScanInput{    TableName: aws.String(os.Getenv("TABLE_NAME")),  })  res, err := req.Send()  if err != nil {    return events.APIGatewayProxyResponse{ StatusCode: http.StatusInternalServerError, ...

Get Hands-On Serverless Applications with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.