mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
update all hello examples to use /{language} as the default route instead of /hello, also renamed hello.payload.json to sample.payload.json
This commit is contained in:
@@ -6,13 +6,13 @@ This example will show you how to test and deploy Go (Golang) code to Oracle Fun
|
||||
|
||||
```sh
|
||||
# Initialize your function creating a func.yaml file
|
||||
fn init <DOCKERHUB_USERNAME>/hello
|
||||
fn init <DOCKERHUB_USERNAME>/go
|
||||
|
||||
# Test your function. This will run inside a container exactly how it will on the server
|
||||
fn run
|
||||
|
||||
# Now try with an input
|
||||
cat hello.payload.json | fn run
|
||||
cat sample.payload.json | fn run
|
||||
|
||||
# Deploy your functions to the Oracle Functions server (default localhost:8080)
|
||||
# This will create a route to your function as well
|
||||
@@ -21,15 +21,15 @@ fn deploy myapp
|
||||
### Now call your function:
|
||||
|
||||
```sh
|
||||
curl http://localhost:8080/r/myapp/hello
|
||||
curl http://localhost:8080/r/myapp/go
|
||||
```
|
||||
|
||||
Or call from a browser: [http://localhost:8080/r/myapp/hello](http://localhost:8080/r/myapp/hello)
|
||||
Or call from a browser: [http://localhost:8080/r/myapp/go](http://localhost:8080/r/myapp/go)
|
||||
|
||||
And now with the JSON input:
|
||||
|
||||
```sh
|
||||
curl -H "Content-Type: application/json" -X POST -d @hello.payload.json http://localhost:8080/r/myapp/hello
|
||||
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/go
|
||||
```
|
||||
|
||||
That's it!
|
||||
@@ -42,7 +42,7 @@ In Go, simply put them all in the `vendor/` directory.
|
||||
|
||||
1. We piped JSON data into the function at the command line
|
||||
```sh
|
||||
cat hello.payload.json | fn run
|
||||
cat sample.payload.json | fn run
|
||||
```
|
||||
|
||||
2. We received our function input through **stdin**
|
||||
@@ -62,4 +62,4 @@ In Go, simply put them all in the `vendor/` directory.
|
||||
|
||||
|
||||
# Next Up
|
||||
## [Tutorial 2: Input Parameters](examples/tutorial/params)
|
||||
## [Tutorial 2: Input Parameters](examples/tutorial/params)
|
||||
|
||||
Reference in New Issue
Block a user