@ankhorage/api-fastify
v0.2.0
Published
Fastify transport adapter and host integration for the Ankhorage API runtime.
Maintainers
Readme
@ankhorage/api-fastify
Fastify transport adapter and host integration for the Ankhorage API runtime.
Usage
CLI
Ankhorage packages expose their command-line interface through ankh. Use ankh --help to discover available package commands, or run a package command with --help for package-specific usage.
# Install the Ankhorage CLI
bun add --global @ankhorage/ankh
# Show usage information for api-fastify
ankh api-fastify --helpBasic Usage
Create a framework-neutral API runtime and expose it through Fastify without moving application handlers into Fastify request/reply code.
const runtime = createApiRuntime({
definition: {
id: "health-api",
origin: "internal",
protocol: "rest",
basePath: "/api",
endpoints: {
health: {
id: "health",
kind: "http",
operations: {
"health.read": {
id: "health.read",
protocol: "http",
intent: "read",
method: "GET",
path: "/health",
},
},
},
},
},
handlers: {
"health.read": () => ({ body: { ok: true } }),
},
});