Create, run, and publish your first Scale Function in minutes.
Hello World
function using the HTTP Signature that will return a simple greeting.
/usr/local/bin
by default, but you can also specify a different directory by setting the INSTALL
environment variable like so:1.18
.0.27.0
.<name>:<tag>
pair to the new
command:
--directory
or -d
flag:
--language
or -l
flag:scalefile
is the main configuration file for the function. It contains all of the metadata and configuration required
to build and run the function. The scale.go
file contains the actual implementation of the function, and
the go.mod
file is primarily used to provide Intellisense
and Auto-Completion support in your IDE.Next()
function. This is because Scale Functions can be
chained together to form a pipeline. The Next()
function is used to pass the context to the next function in the chain
and can be conditionally called based on the logic in your function.
This allows for powerful composability that’s completely language agnostic. For example, you can use a rust function to validate the request, a golang function to process the
request, and a third rust function to generate the response!
If you call the Next()
field and there is no next function in the chain, the function is a no-op and the context is returned.
scalefile
to make sure
your function can be built properly.HTTP Signature
,
which provides an interface for handling HTTP requests and responses. To learn more about the HTTP Signature
and the
interfaces it provides, you can check out the HTTP Signature Reference.
Signature
is central to how Scale Functions provide cross-language type safety and it’s documented
in more detail in the Signatures section of the documentation.Cache Directory
(which defaults to ~/.config/scale/functions
on Linux and macOS).
You can also specify a different directory by passing the --cache-directory
flag:
Cache Directory
is where the Scale CLI stores all of the built functions. This is where the CLI will look for
functions when you run commands like scale fn run
or scale fn push
.Cache Directory
, you can run the following command:
8080
and will run the function whenever you make a request to it. You can
also specify a different port by passing the --listen
or -l
flag:
scale fn run
command is designed for use with the HTTP Signature. It can be used for both
local development and production deployments and makes it easy to test your function without having to deploy it.#scale
channel on our Discord.#scale
channel in our Discord.scale auth status
command.If you pushed the function using the --public
flag, you can pull it without being authenticated with the Scale API.Cache Directory
(which defaults to ~/.config/scale/functions
on Linux and macOS).
You can also specify a different directory by passing the --cache-directory
flag:
scale pull
command only pulls the contents of the scale function from the registry if it’s not already present.
If the function is already present, it will not be overwritten unless the --force
flag is passed.