To get started, we need to implement the function responsible for returning a list of movies; the following steps describe how to achieve that:
- 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, ...