// health — the simplest function: a GET diagnostic. // // Demonstrates: GET (input from the query string), reading `ctx.env`, and a // pure synchronous handler (`Effect.sync`). No I/O, no secrets. // // voltro serverless dev functions/health.serverless.ts // curl http://localhost:8910/ import { Effect, Schema } from 'effect' import { defineServerless } from '@voltro/serverless' export default defineServerless({ name: 'health', method: 'GET', input: Schema.Struct({}), output: Schema.Struct({ status: Schema.Literal('ok'), region: Schema.String, now: Schema.String, }), handler: (_input, ctx) => Effect.sync(() => ({ status: 'ok' as const, // The provider injects region into the env (Scaleway SCW_REGION, your own // VOLTRO_REGION on a node host). Cloudflare is global → 'edge'. region: ctx.env.VOLTRO_REGION ?? ctx.env.SCW_REGION ?? ctx.env.AWS_REGION ?? 'edge', now: new Date().toISOString(), })), })