---
agent:
  instructions: "Use this search API to find Volcano documentation, blog posts, and cookbook recipes with keywords or a natural-language question, instead of crawling individual pages. Results are markdown: the best-matching pages with the sections that matched, and a link to each page's full markdown."
  endpoint: "https://docs.staging.volcano.dev/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.staging.volcano.dev/docs/cli/docs-search#search-from-an-agent-over-http"
---

# Node.js Hello World Example

This is a simple function that demonstrates the Volcano platform.

# Node.js Hello World Example

This is a simple function that demonstrates the Volcano platform.

## Deploy

From `volcano/functions`, zip the handler and upload it. New functions are
`private`, so only service keys could call this one; `visibility=authenticated`
lets your project's signed-in users invoke it too.

```bash
zip function.zip index.js
curl -X POST https://api.volcano.dev/projects/PROJECT_ID/functions \
  -H "Authorization: Bearer $PLATFORM_TOKEN" \
  -F "name=hello-world" \
  -F "code=@function.zip" \
  -F "runtime=nodejs24.x" \
  -F "handler=handler" \
  -F "visibility=authenticated"
```

## Invoke

Call it with a signed-in user's access token:

```bash
curl -X POST https://api.volcano.dev/functions/FUNCTION_ID/invoke \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"payload":{"name":"Volcano"}}'
```

## Expected Response

```json
{
  "status_code": 200,
  "payload": {
    "statusCode": 200,
    "headers": {
      "Content-Type": "application/json"
    },
    "body": "{\"message\":\"Hello, Volcano!\",\"environment\":\"production\",\"timestamp\":\"2024-01-01T00:00:00.000Z\"}"
  }
}
```
