Files
fission-src/examples/go
Soam VasaniandGitHub a6eb4c6d31 Go build helper script (#163)
Create a docker container and a script to call it, to help people build go plugins for use with fission.
2017-03-27 23:26:59 -07:00
..
2017-03-21 17:13:29 -07:00
2017-03-27 23:26:59 -07:00

Go examples

The go runtime uses the plugin package to dynamically load an HTTP handler.

Requirements

To use this environment, download the build helper script.

The script must be run in the same directory as the function you're building.

Examples

hello.go is an very basic HTTP handler returning "Hello, World!".

# Build the function as a plugin. Outputs result to 'function.so'.
$ go-function-build hello.go

# Upload the function to fission
$ fission function create --name hello --env go-runtime --package function.so

# Map /hello to the hello function
$ fission route create --method GET --url /hello --function hello

# Run the function
$ curl http://$FISSION_ROUTER/hello
Hello, World!