Getting Started
First, you’ll need a Golang application that uses the FastHTTP library. If you don’t have a Golang application, you can use the following example to get started:main.go
Embedding a Scale Function
To get started, let’s create a Scale Function that returns a simple ‘Hello World’ message. This is as simple as running the following command:We’re implicitly using the Go Guest Language in this example, but you can use any of the supported
Guest Languages. To use a different Guest Language, you can use the
--language
flag when creating a new Scale Function.scale.go
file that gets generated. The Scale Function is a simple HTTP handler that returns a Hello World
message:
hello-latest.scale
file in the current directory. Now we have everything we need to import
the Scale Function into our Golang application.
Check out the Scale CLI documentation for more information on how to use the Scale CLI to build and export
Scale Functions.
import
statement:
main.go