Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes on Introduction tutorial #175

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Introduction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ In the terminal type the following:
The output will be

```yaml
Creating function at: /gofn
Creating function at: ./gofn
Runtime: go
Function boilerplate generated.
func.yaml created.
Expand All @@ -43,10 +43,10 @@ func.yaml created.
The `fn init` command creates an simple function with a bit of boilerplate to
get you started. The `--runtime` option is used to indicate that the function
we're going to develop will be written in Go. A number of other runtimes are
also supported. Fn creates the simple function along with several supporting files in the `/gofn` directory.
also supported. Fn creates the simple function along with several supporting files in the `./gofn` directory.

### Review your Function File
With your function created change into the `/gofn` directory.
With your function created change into the `./gofn` directory.

![User Input Icon](images/userinput.png)
>```sh
Expand All @@ -61,7 +61,7 @@ Now get a list of the directory contents.
>```

```txt
Gopkg.toml func.go func.yaml
func.go func.yaml go.mod
```

The `func.go` file which contains your actual Go function is generated along
Expand Down Expand Up @@ -125,9 +125,9 @@ version: 0.0.1
runtime: go
entrypoint: ./func
triggers:
- name: gofn-trigger
- name: gofn
type: http
source: /gofn-trigger
source: /gofn
```

The generated `func.yaml` file contains metadata about your function and
Expand All @@ -142,7 +142,7 @@ in `--runtime`.
in this case `./func`
* triggers--identifies the automatically generated trigger name and source. For
example, this function would be executed from the URL
<http://localhost:8080/t/appname/gofn-trigger>. Where appname is the name of
<http://localhost:8080/t/appname/gofn>. Where appname is the name of
the app chosen for your function when it is deployed.

There are other user specifiable properties but these will suffice for
Expand All @@ -152,7 +152,7 @@ folder name. We'll see this come into play later on.
### Other Function Files
The `fn init` command generated one other file.

* `Gopkg.toml` -- the Go dep tool dependency management tool file which
* `go.mod` -- the Go dep tool dependency management tool file which
specifies all the dependencies for your function.

## Deploy Your First Function
Expand Down Expand Up @@ -266,8 +266,8 @@ Successfully tagged fndemouser/gofn:0.0.2

Updating function gofn using image fndemouser/gofn:0.0.2...
Successfully created function: gofn with fndemouser/gofn:0.0.2
Successfully created trigger: gofn-trigger
Trigger Endpoint: http://localhost:8080/t/goapp/gofn-trigger
Successfully created trigger: gofn
Trigger Endpoint: http://localhost:8080/t/goapp/gofn
```

All the steps to load the current language Docker image are displayed.
Expand All @@ -285,7 +285,7 @@ let's us know that the function is packaged in the image
Note that the containing folder name `gofn` was used as the name of the
generated Docker container and used as the name of the function that container
was bound to. By convention it is also used to create the trigger name
`gofn-trigger`.
`gofn`.

Normally you deploy an application without the `--verbose` option. If you rerun the command a new image and version is created and loaded.

Expand Down Expand Up @@ -392,7 +392,7 @@ We can also see the functions that are defined by an application. Since function

```sh
FUNCTION NAME ID TYPE SOURCE ENDPOINT
gofn gofn-trigger 01D37X3AVGNG8G00GZJ0000003 http /gofn-trigger http://localhost:8080/t/goapp/gofn-trigger
gofn gofn 01D37X3AVGNG8G00GZJ0000003 http /gofn http://localhost:8080/t/goapp/gofn
```

The output confirms that `goapp` contains a `gofn` function which may be invoked via the
Expand All @@ -402,14 +402,14 @@ call our function.
### Invoke with Curl

The other way to invoke your function is via HTTP. The Fn server exposes our
deployed function at `http://localhost:8080/t/goapp/gofn-trigger`, a URL
deployed function at `http://localhost:8080/t/goapp/gofn`, a URL
that incorporates our application and function trigger as path elements.

Use `curl` to invoke the function:

![user input](images/userinput.png)
>```sh
> curl -H "Content-Type: application/json" http://localhost:8080/t/goapp/gofn-trigger
> curl -H "Content-Type: application/json" http://localhost:8080/t/goapp/gofn
>```

The result is once again the same.
Expand All @@ -423,7 +423,7 @@ the function back.

![user input](images/userinput.png)
>```
> curl -H "Content-Type: application/json" -d '{"name":"Bob"}' http://localhost:8080/t/goapp/gofn-trigger
> curl -H "Content-Type: application/json" -d '{"name":"Bob"}' http://localhost:8080/t/goapp/gofn
>```

The result is once again the same.
Expand Down