FaaS
FaaS, also known as serverless, is an interesting concept that abstracts away the infrastructure. The idea is simple: you implement a function that is executed whenever something happens; in our case, we are building APIs, which can react to an HTTP request. When that HTTP request occurs, your function gets called, and the result is returned to the user. And that’s all you have to worry about: your function.
FaaS implementations can vary from one to another, but the idea is the same. In this case, I will use AWS Lambda as an example, but you can also use others, such as Google Cloud Functions, Azure Functions, or OpenFaaS.
Whenever you are using AWS Lambda, you have to define the function that you want to execute, so let’s start there:
package main
import (
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {...