Skip to content

Files

go-hello-world

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023

Golang hello world

This is a simple example of how to create a Golang function to run on Scaleway Serverless Functions.

Requirements

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.

Setup

First set up Serverless Framework with:

npm i

You can run your function locally with:

go run test/main.go

Then 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 deploy

Once deployed, you can again submit a request using curl to the URL printed in the deployment output.