Files
wehub-resource-sync 3a28426bf4
Lint and Format Check / lint-and-format (push) Failing after 0s
Check Migrations / Check for duplicate migration numbers (push) Failing after 1s
CI Pre-merge Check / CI Pre-merge Check (push) Failing after 2m17s
chore: import upstream snapshot with attribution
2026-07-13 12:23:40 +08:00

32 lines
837 B
Markdown

# InsForge Edge Function Examples
This folder contains **example serverless (edge) functions** you can deploy to InsForge.
## Files
- `demo-hello-world.js`: public function (GET/POST) with CORS + secret example (`HELLO_PREFIX`)
- `demo-whoami.js`: authenticated function (GET) that returns the current user
## Deploy
Use the InsForge MCP tools:
- `create-function` with `slug` matching the function name you want (e.g. `demo-hello-world`)
- `update-function` to redeploy after edits
## Invoke from a client app (SDK)
```js
// GET
await insforge.functions.invoke('demo-hello-world', { method: 'GET' })
// POST
await insforge.functions.invoke('demo-hello-world', {
body: { name: 'Gary' }
})
// Authenticated GET (SDK auto-includes user token if logged in)
await insforge.functions.invoke('demo-whoami', { method: 'GET' })
```