@frontal-labs/workers
v0.1.3
Published
Frontal Workers SDK — deploy and invoke serverless workers on the edge runtime
Maintainers
Readme
@frontal-labs/workers
Client for Frontal Workers — the serverless edge runtime (/v1/workers).
Deploy a worker from source, then invoke it by path.
Renamed from
@frontal-labs/functions. The backend service is the Frontal edge runtime and refers to these as workers.
Installation
npm install @frontal-labs/workersQuick Start
import { workers } from "@frontal-labs/workers";
// Deploy a worker from source.
await workers.deploy({
name: "hello",
code: "export default () => new Response('hello from the edge')",
envVars: { GREETING: "hi" },
});
// Invoke it (returns the raw Response).
const res = await workers.invoke("hello", { path: "/", method: "GET" });
console.log(await res.text());Environment Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| FRONTAL_API_KEY | Yes | — | Frontal API authentication key |
| FRONTAL_API_URL | No | https://api.frontal.dev/v1 | Base URL for the Frontal API |
| FRONTAL_ENV | No | development | Runtime environment (development, test, production) |
| FRONTAL_DEBUG | No | false | Enable debug logging |
