Skip to content

Commit 61daa7a

Browse files
kunihiko-tc0ze
authored andcommitted
Updated the document of examples/error (#652)
1 parent 4cf3fb7 commit 61daa7a

File tree

5 files changed

+19
-71
lines changed

5 files changed

+19
-71
lines changed

examples/error/Dockerfile

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

examples/error/README.md

Lines changed: 18 additions & 57 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
19-
```
20-
21-
### Publishing to DockerHub
22-
23-
```
24-
# tagging
25-
docker run --rm -v "$PWD":/app treeder/bump patch
26-
docker tag $USERNAME/func-error:latest $USERNAME/func-error:`cat VERSION`
27-
28-
# pushing to docker hub
29-
docker push $USERNAME/func-error
30-
```
31-
32-
### Testing image
33-
345
```
35-
./test.sh
6+
# Create your func.yaml file
7+
fn init <YOUR_DOCKERHUB_USERNAME>/func-error
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> /error
3617
```
3718

3819
## Running it on IronFunctions
@@ -41,37 +22,17 @@ docker push $USERNAME/func-error
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=error
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 `error`.
51-
52-
```
53-
curl -X POST --data '{
54-
"app": {
55-
"name": "error",
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-error",
66-
"path": "/error",
67-
}
68-
}' http://$FUNCAPI/v1/apps/error/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/error/error
77-
```
37+
curl -X POST --data '{"input": "yoooo"}' http://$FUNCAPI/r/$APPNAME/error
38+
```

examples/error/VERSION

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

examples/error/build.sh

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

examples/error/function.rb renamed to examples/error/func.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require_relative 'bundle/bundler/setup'
12
require 'json'
23

34
payload = STDIN.read

0 commit comments

Comments
 (0)