<commit_before># Tutorial 1: Go Function w/ Input (3 minutes)

This example will show you how to test and deploy Go (Golang) code to Oracle Functions. It will also demonstrate passing data in through stdin.

### First, run the following commands to create, run, and deploy your function:

```sh
# Initialize your function creating a func.yaml file
fn init <DOCKERHUB_USERNAME>/hello

# 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

# Deploy your functions to the Oracle Functions server (default localhost:8080)
# This will create a route to your function as well
fn deploy myapp
```
### Now call your function:

```sh
curl http://localhost:8080/r/myapp/hello
```
### Or call from a browser: [http://localhost:8080/r/myapp/hello](http://localhost:8080/r/myapp/hello)

### 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
```

### That's it!

# In Review

1. We piped JSON data into the function at the command line
    ```sh
    cat hello.payload.json | fn run
    ```

2. We received our input through stdin<commit_msg>readme mods<commit_after># Tutorial 1: Go Function w/ Input (3 minutes)

This example will show you how to test and deploy Go (Golang) code to Oracle Functions. It will also demonstrate passing data in through stdin.

### First, run the following commands:

```sh
# Initialize your function creating a func.yaml file
fn init <DOCKERHUB_USERNAME>/hello

# 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

# Deploy your functions to the Oracle Functions server (default localhost:8080)
# This will create a route to your function as well
fn deploy myapp
```
### Now call your function:

```sh
curl http://localhost:8080/r/myapp/hello
```

Or call from a browser: [http://localhost:8080/r/myapp/hello](http://localhost:8080/r/myapp/hello)

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
```

That's it!

# In Review

1. We piped JSON data into the function at the command line
    ```sh
    cat hello.payload.json | fn run
    ```

2. We received our input through stdin
{'fraction_non_alphanumeric': 0.10008375209380234, 'fraction_numerical': 0.020100502512562814, 'mean_word_length': 3.9667359667359667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5546778', 'n_tokens_mistral': 761, 'n_tokens_neox': 698, 'n_words': 321}