mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* See the hello/go README for how this all works now. * Node support for fnctl auto build * Updated based on PR comments.
763 B
763 B
Quick Example for a Go Function (3 minutes)
This example will show you how to test and deploy Go (Golang) code to IronFunctions.
fnctl init <YOUR_DOCKERHUB_USERNAME>/hello
fnctl build
# test it
cat hello.payload.json | fnctl run
# push it to Docker Hub
fnctl push
# Create a route to this function on IronFunctions
fnctl routes create myapp /hello YOUR_DOCKERHUB_USERNAME/hello:0.0.X
# todo: Image name could be optional if we read the function file for creating the route. Then command could be:
fnctl routes create myapp /hello
Now you use your function on IronFunctions:
curl -H "Content-Type: application/json" -X POST -d @hello.payload.json http://localhost:8080/r/myapp/hello
Or surf to it: http://localhost:8080/r/myapp/hello