# Hello World Function Example

This is a simple example function that demonstrates how to create and deploy functions in the Skybridge FaaS platform.

## Function Description

The function takes a JSON input with an optional `name` field and returns a greeting message.

### Input Format
```json
{
  "name": "John"
}
```

### Output Format
```json
{
  "message": "Hello, John!",
  "input": {
    "name": "John"
  }
}
```

## Building the Function

To build the function as a Docker image:

```bash
docker build -t hello-world-function .
```

## Testing the Function Locally

To test the function locally:

```bash
# Test with a name
docker run -e FUNCTION_INPUT='{"name": "Alice"}' hello-world-function

# Test without a name (defaults to "World")
docker run hello-world-function
```

## Deploying to Skybridge FaaS

Once you have the Skybridge FaaS platform running, you can deploy this function using the API:

1. Create the function:
```bash
curl -X POST http://localhost:8083/api/functions \
  -H "Content-Type: application/json" \
  -H "X-User-Email: test@example.com" \
  -d '{
    "name": "hello-world",
    "image": "hello-world-function",
    "runtime": "custom",
    "memory": 128,
    "timeout": "30s"
  }'
```

2. Deploy the function:
```bash
curl -X POST http://localhost:8083/api/functions/{function-id}/deploy \
  -H "X-User-Email: test@example.com"
```

3. Execute the function:
```bash
curl -X POST http://localhost:8083/api/functions/{function-id}/execute \
  -H "Content-Type: application/json" \
  -H "X-User-Email: test@example.com" \
  -d '{"input": {"name": "Bob"}}'
