@owlmeans/server-entrypoint
v0.1.11
Published
Elevates route definitions into runnable server entrypoints with attached request handlers.
Downloads
2,577
Readme
@owlmeans/server-entrypoint
Elevates route definitions into runnable server entrypoints with attached request handlers.
Overview
elevate(entrypoints, alias, handler?, opts?)attaches aRefedEntrypointHandlerto an existing entrypoint in placeentrypoint(commonEntrypoint, handler?, opts?)wraps aCommonEntrypointinto aServerEntrypointguard(alias, opts?)createsEntrypointOptionsrequiring a named guard service- Used internally by
@owlmeans/server-app'selevatere-export
Installation
bun add @owlmeans/server-entrypointUsage
Typical pattern — define entrypoints separately, elevate with handlers:
import { elevate, guard } from '@owlmeans/server-app'
import { handleBody, handleParams } from '@owlmeans/server-app'
const appModules = [
entrypoint(route('project-create', '/projects', backend(RouteMethod.POST)), guard('auth')),
entrypoint(route('project-get', '/projects/:id', backend())),
]
elevate(appModules, 'project-create', handleBody(async (payload, ctx) => {
return await ctx.project().create(payload)
}))
elevate(appModules, 'project-get', handleParams(async (params, ctx) => {
return await ctx.project().get(params.id)
}))API
elevate<R>(entrypoints, alias, handler?, opts?): ServerEntrypoint<R>[]
Mutates entrypoints in-place: finds the entrypoint with alias and attaches handler. Throws if the alias is not found or already elevated (unless opts.force is true).
entrypoint<R>(commonEntrypoint, handler?, opts?): ServerEntrypoint<R>
Wraps a single CommonEntrypoint into a ServerEntrypoint. Lower-level than elevate.
guard<R>(guard, opts?): EntrypointOptions<R>
Returns EntrypointOptions that require the named guard service to pass before the handler runs.
ServerEntrypoint<R>
Extends CommonEntrypoint with:
route: ServerRouteModel<R>— resolved server routehandle: RefedEntrypointHandler<R>— the attached handler
RefedEntrypointHandler<R>
A handler factory: (ref: { ref?: { ctx?: Context } }) => EntrypointHandler.
Related Packages
@owlmeans/entrypoint—CommonEntrypointbase that gets elevated@owlmeans/server-api— handler wrappers (handleBody, etc.) used withelevate@owlmeans/server-app— re-exportselevate,entrypoint,guard
Agent guidance
This package ships embedded Claude Code skills and GitHub Copilot instructions under
agent-meta/. After installing your @owlmeans/* packages, run the OwlMeans
agent-skills installer to place them into your project's native locations
(.claude/skills/ and .github/instructions/):
npx @owlmeans/agent-skillsThe embedded files are version-matched to this package release. Do not edit them directly — they are regenerated on each publish. To contribute guidance edits, open a PR against the source monorepo.
