Skip to content

Commit d434952

Browse files
kunihiko-tc0ze
authored andcommitted
[skip ci] Updated the document of examples/echo (#646)
* [skip ci] Updated the document of examples/echo A few params seems to be incorrect. * Undo the changes of docker tag command * Use fn instead of docker command
1 parent 0fe19e8 commit d434952

File tree

5 files changed

+17
-74
lines changed

5 files changed

+17
-74
lines changed

examples/echo/README.md

Lines changed: 17 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,18 @@
22

33
This images compares the payload info with the header.
44

5-
## Requirements
6-
7-
- IronFunctions API
8-
9-
## Development
10-
11-
### Building image locally
12-
13-
```
14-
# SET BELOW TO YOUR DOCKER HUB USERNAME
15-
USERNAME=YOUR_DOCKER_HUB_USERNAME
16-
17-
# build it
18-
./build.sh
195
```
20-
21-
### Publishing to DockerHub
22-
23-
```
24-
# tagging
25-
docker run --rm -v "$PWD":/app treeder/bump patch
26-
docker tag $USERNAME/func-echo:latest $USERNAME/func-echo:`cat VERSION`
27-
28-
# pushing to docker hub
29-
docker push $USERNAME/func-echo
30-
```
31-
32-
### Testing image
33-
34-
```
35-
./test.sh
6+
# Create your func.yaml file
7+
fn init <YOUR_DOCKERHUB_USERNAME>/func-echo
8+
# Build the function
9+
fn build
10+
# Test it
11+
echo '{"input": "yoooo"}' | fn run
12+
# Push it to Docker Hub
13+
fn push
14+
# Create routes to this function on IronFunctions
15+
fn apps create <YOUR_APP>
16+
fn routes create <YOUR_APP> /echo
3617
```
3718

3819
## Running it on IronFunctions
@@ -41,37 +22,17 @@ docker push $USERNAME/func-echo
4122

4223
```
4324
# Set your Function server address
44-
# Eg. 127.0.0.1:8080
25+
# Eg.
26+
# FUNCAPI=127.0.0.1:8080
27+
# APPNAME=echo
4528
FUNCAPI=YOUR_FUNCTIONS_ADDRESS
29+
APPNAME=YOUR_APP
4630
```
4731

48-
### Running with IronFunctions
49-
50-
With this command we are going to create an application with name `echo`.
51-
52-
```
53-
curl -X POST --data '{
54-
"app": {
55-
"name": "echo",
56-
}
57-
}' http://$FUNCAPI/v1/apps
58-
```
59-
60-
Now, we can create our route
61-
62-
```
63-
curl -X POST --data '{
64-
"route": {
65-
"image": "'$USERNAME'/func-echo",
66-
"path": "/echo",
67-
}
68-
}' http://$FUNCAPI/v1/apps/echo/routes
69-
```
70-
71-
#### Testing function
32+
### Testing function
7233

7334
Now that we created our IronFunction route, let's test our new route
7435

7536
```
76-
curl -X POST --data '{"input": "yoooo"}' http://$FUNCAPI/r/echo/echo
37+
curl -X POST --data '{"input": "yoooo"}' http://$FUNCAPI/r/$APPNAME/echo
7738
```

examples/echo/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/echo/build.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/echo/func.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/echo/test.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)