diff --git a/docs/hot-functions.md b/docs/hot-functions.md index 67b47311b..3d1b5cceb 100644 --- a/docs/hot-functions.md +++ b/docs/hot-functions.md @@ -19,8 +19,7 @@ input/output. ## Implementing a hot function -In the [examples directory](https://github.com/treeder/functions/blob/master/examples/hotfunctions/http/func.go), there is one simple implementation of a hot function -which we are going to get in the details here. +Let's look at a simple hot function. The examples directory contains a [simple example of a hot function written in go](/examples/tutorial/hotfunctions/http/go). Here's [func.go](/examples/tutorial/hotfunctions/http/go/func.go) from that example. The basic cycle comprises three steps: read standard input up to a previosly known point, process the work, the write the output to stdout with some diff --git a/examples/tutorial/hotfunctions/http/go/README.md b/examples/tutorial/hotfunctions/http/go/README.md new file mode 100644 index 000000000..5a8aa3233 --- /dev/null +++ b/examples/tutorial/hotfunctions/http/go/README.md @@ -0,0 +1,22 @@ +# Hot Function Example + +This is an example of a hot function. The [hot function documentation](/docs/hot-functions.md) contains an analysis of how this example works. + +### How to run the example + +Install the CLI tool, start a Fn server and run `docker login` to login to DockerHub. See the [front page](README.md) for instructions. + +Set your Docker Hub username + +```export FN_REGISTRY= +``` + +Build and deploy the function to the Fn server (default localhost:8080) + +fn deploy --app hot-app +``` + +Now call your function: + +```curl -X POST -d "World" http://localhost:8080/r/hot-app/%2Fhotfn-go +``` diff --git a/examples/tutorial/hotfunctions/http/go/func.yaml b/examples/tutorial/hotfunctions/http/go/func.yaml new file mode 100644 index 000000000..c443b570e --- /dev/null +++ b/examples/tutorial/hotfunctions/http/go/func.yaml @@ -0,0 +1,6 @@ +name: hotfunction-http +version: 0.0.10 +runtime: go +entrypoint: ./func +format: http +path: /hotfn-go diff --git a/examples/tutorial/hotfunctions/http/go/hotroute.json b/examples/tutorial/hotfunctions/http/go/hotroute.json deleted file mode 100644 index 58438a235..000000000 --- a/examples/tutorial/hotfunctions/http/go/hotroute.json +++ /dev/null @@ -1,6 +0,0 @@ -{"route":{ - "memory": 64, - "type": "sync", - "config": null, - "format": "http" -}}