This is a simple example of how to create a Golang function to run on Scaleway Serverless Functions.
This example assumes you are familiar with how serverless functions work. If needed, you can check Scaleway's official documentation
This example uses the Scaleway Serverless Framework Plugin. Please set up your environment with the requirements stated in the Scaleway Serverless Framework Plugin before trying out the example.
Additionnaly it uses the serverless-functions-go library for local testing.
First set up Serverless Framework with:
npm iYou can run your function locally with:
go run test/main.goThen in another terminal, you can make a request:
curl http://localhost:8080... and run the tests:
go test ./...If the tests succeed, you can deploy your function with:
serverless deployOnce deployed, you can again submit a request using curl to the URL printed in the deployment output.