diff --git a/examples/tutorial/hello/go/README.md b/examples/tutorial/hello/go/README.md index 4c05bee69..5de531b8d 100644 --- a/examples/tutorial/hello/go/README.md +++ b/examples/tutorial/hello/go/README.md @@ -6,7 +6,7 @@ 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 /go +fn init /hello-go # Test your function. This will run inside a container exactly how it will on the server fn run @@ -18,18 +18,19 @@ cat sample.payload.json | fn run # This will create a route to your function as well fn deploy myapp ``` + ### Now call your function: ```sh -curl http://localhost:8080/r/myapp/go +curl http://localhost:8080/r/myapp/hello-go ``` -Or call from a browser: [http://localhost:8080/r/myapp/go](http://localhost:8080/r/myapp/go) +Or call from a browser: [http://localhost:8080/r/myapp/go](http://localhost:8080/r/myapp/hello-go) And now with the JSON input: ```sh -curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/go +curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-go ``` That's it! diff --git a/examples/tutorial/hello/java/README.md b/examples/tutorial/hello/java/README.md index f5a5fbd31..3b4d624e5 100644 --- a/examples/tutorial/hello/java/README.md +++ b/examples/tutorial/hello/java/README.md @@ -1,43 +1,51 @@ # Oracle Functions: Java -This is a hello world example of a Oracle Function using the Java runtime. +This example will show you how to test and deploy Java code to Oracle Functions. It will also demonstrate passing data in through stdin. -Firstly, we initialize our function by creating a `func.yaml` using `fn init`. This command can optionally take a `--runtime` flag to explicitly specify the target function runtime. In this example, the target runtime is implied to be Java because there is a `Func.java` file in the working directory. +### First, run the following commands: ```sh -$ fn init /hello-java +# Initialize your function creating a func.yaml file +fn init /hello-go + +# Test your function. This will run inside a container exactly how it will on the server +fn run + +# Now try with an input +echo "Michael FassBender" | fn run + +# Deploy your functions to the Oracle Functions server (default localhost:8080) +# This will create a route to your function as well +fn deploy myapp ``` -This is what our `func.yaml` looks like now. - - -``` -name: mhaji/hello-java -version: 0.0.1 -runtime: java -entrypoint: java Func -path: /hello-java -max_concurrency: 1 -``` - -Next, we build and run our function using `fn run`. - +### Now call your function: ```sh -$ fn run -Hello, world! +curl http://localhost:8080/r/myapp/hello-java ``` -You can also pipe input via `stdin` into to the function as follows: +Or call from a browser: [http://localhost:8080/r/myapp/hello-java](http://localhost:8080/r/myapp/hello-java) -```sh -$ echo "Michael FassBender" | fn run -Hello Michael FassBender! -``` +That's it! -To execute your function via a HTTP trigger: -```sh -fn apps create myapp -fn routes create myapp /hello -curl -H "Content-Type: text/plain" -X POST -d "Michael FassBender" http://localhost:8080/r/myapp/hello -``` \ No newline at end of file +# In Review + +1. We passed in data through stdin + ```sh + echo "Michael FassBender" | fn run + ``` + +2. We received our function input through **stdin** + ```go + String name = bufferedReader.readLine(); + ``` + +3. We wrote our output to **stdout** + ```go + System.out.println("Hello, " + name + "!"); + ``` + + +# Next Up +## [Tutorial 2: Input Parameters](examples/tutorial/params) diff --git a/examples/tutorial/hello/node/README.md b/examples/tutorial/hello/node/README.md index bfb749c1c..72fce8a8c 100644 --- a/examples/tutorial/hello/node/README.md +++ b/examples/tutorial/hello/node/README.md @@ -6,7 +6,7 @@ This example will show you how to test and deploy Node code to Oracle Functions. ```sh # Initialize your function creating a func.yaml file -fn init /node +fn init /hello-node # Test your function. # This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile @@ -22,15 +22,15 @@ fn deploy myapp ### Now call your function: ```sh -curl http://localhost:8080/r/myapp/node +curl http://localhost:8080/r/myapp/hello-node ``` -Or call from a browser: [http://localhost:8080/r/myapp/node](http://localhost:8080/r/myapp/node) +Or call from a browser: [http://localhost:8080/r/myapp/hello-node](http://localhost:8080/r/myapp/hello-node) And now with the JSON input: ```sh -curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/node +curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-node ``` That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.js` diff --git a/examples/tutorial/hello/php/README.md b/examples/tutorial/hello/php/README.md index b615e6e27..9276ff3e0 100644 --- a/examples/tutorial/hello/php/README.md +++ b/examples/tutorial/hello/php/README.md @@ -6,7 +6,7 @@ This example will show you how to test and deploy PHP code to Oracle Functions. ```sh # Initialize your function creating a func.yaml file -fn init /php +fn init /hello-php # Test your function. # This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile @@ -22,15 +22,15 @@ fn deploy myapp ### Now call your function: ```sh -curl http://localhost:8080/r/myapp/php +curl http://localhost:8080/r/myapp/hello-php ``` -Or call from a browser: [http://localhost:8080/r/myapp/php](http://localhost:8080/r/myapp/php) +Or call from a browser: [http://localhost:8080/r/myapp/hello-php](http://localhost:8080/r/myapp/hello-php) And now with the JSON input: ```sh -curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/php +curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-php ``` That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.php` diff --git a/examples/tutorial/hello/python/README.md b/examples/tutorial/hello/python/README.md index 773c48597..c8d1402b6 100644 --- a/examples/tutorial/hello/python/README.md +++ b/examples/tutorial/hello/python/README.md @@ -6,7 +6,7 @@ This example will show you how to test and deploy Python code to Oracle Function ```sh # Initialize your function creating a func.yaml file -fn init /python +fn init /hello-python # Test your function. # This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile @@ -22,15 +22,15 @@ fn deploy myapp ### Now call your function: ```sh -curl http://localhost:8080/r/myapp/python +curl http://localhost:8080/r/myapp/hello-python ``` -Or call from a browser: [http://localhost:8080/r/myapp/python](http://localhost:8080/r/myapp/python) +Or call from a browser: [http://localhost:8080/r/myapp/hello-python](http://localhost:8080/r/myapp/hello-python) And now with the JSON input: ```sh -curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/python +curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-python ``` That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.py` diff --git a/examples/tutorial/hello/ruby/README.md b/examples/tutorial/hello/ruby/README.md index eb4f74bdc..732ecef6a 100644 --- a/examples/tutorial/hello/ruby/README.md +++ b/examples/tutorial/hello/ruby/README.md @@ -6,7 +6,7 @@ This example will show you how to test and deploy Ruby code to Oracle Functions. ```sh # Initialize your function creating a func.yaml file -fn init /ruby +fn init /hello-ruby # Test your function. # This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile @@ -22,15 +22,15 @@ fn deploy myapp ### Now call your function: ```sh -curl http://localhost:8080/r/myapp/ruby +curl http://localhost:8080/r/myapp/hello-ruby ``` -Or call from a browser: [http://localhost:8080/r/myapp/ruby](http://localhost:8080/r/myapp/ruby) +Or call from a browser: [http://localhost:8080/r/myapp/hello-ruby](http://localhost:8080/r/myapp/hello-ruby) And now with the JSON input: ```sh -curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/ruby +curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-ruby ``` That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.rb` diff --git a/examples/tutorial/hello/rust/README.md b/examples/tutorial/hello/rust/README.md index 25675af52..24539616d 100644 --- a/examples/tutorial/hello/rust/README.md +++ b/examples/tutorial/hello/rust/README.md @@ -34,7 +34,7 @@ fn main() { ```sh # Initialize your function creating a func.yaml file -fn init /rust +fn init /hello-rust # Test your function. This will run inside a container exactly how it will on the server fn run @@ -49,15 +49,15 @@ fn deploy myapp ### Now call your function: ```sh -curl http://localhost:8080/r/myapp/rust +curl http://localhost:8080/r/myapp/hello-rust ``` -Or call from a browser: [http://localhost:8080/r/myapp/rust](http://localhost:8080/r/myapp/rust) +Or call from a browser: [http://localhost:8080/r/myapp/hello-rust](http://localhost:8080/r/myapp/hello-rust) And now with the JSON input: ```sh -curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/rust +curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-rust ``` That's it!