mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Docs update with new fnctl commands (#273)
* Added high level roadmap. * Changed to funtion.yaml. * Added logo * updating quickstart code example, WIP, waiting on another merge. * Minor updates. * Changed function.yaml to func.yaml and updated fnctl README.
This commit is contained in:
2
examples/hello/go/.gitignore
vendored
2
examples/hello/go/.gitignore
vendored
@@ -4,4 +4,4 @@ vendor/
|
||||
/app
|
||||
/__uberscript__
|
||||
|
||||
function.yaml
|
||||
func.yaml
|
||||
|
||||
@@ -3,22 +3,20 @@
|
||||
This example will show you how to test and deploy Go (Golang) code to IronFunctions.
|
||||
|
||||
```sh
|
||||
# create your func.yaml file
|
||||
fnctl init <YOUR_DOCKERHUB_USERNAME>/hello
|
||||
# build the function
|
||||
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:
|
||||
Now you can call your function on IronFunctions:
|
||||
|
||||
```sh
|
||||
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
|
||||
|
||||
4
examples/hello/go/function.yaml
Normal file
4
examples/hello/go/function.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
name: treeder/hello4
|
||||
version: 0.0.1
|
||||
runtime: go
|
||||
entrypoint: ./func
|
||||
@@ -13,5 +13,5 @@ type Person struct {
|
||||
func main() {
|
||||
p := &Person{Name: "World"}
|
||||
json.NewDecoder(os.Stdin).Decode(p)
|
||||
fmt.Println("Hello", p.Name, "!!!")
|
||||
fmt.Printf("Hello %v!", p.Name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user