@cocoframe/core
v0.0.4
Published
Server-first page, API, layout, middleware, SEO, and application contracts for CocoFrame.
Maintainers
Readme
@cocoframe/core
The page, API, middleware, request-context, SEO document, and Web Standard application handler contract.
Public surface
definePage,defineLayout, andwithLayoutsdefine server-rendered pages.defineApidefines optional schema-backed API contracts.defineConfig,defineMiddleware, andcreateContextKeydefine application-wide behavior and typed request state.CocoFrameAppregisters routes and exposesfetch(Request).rerender,redirect, andjsonexpress standard response behavior.deferstreams supplementary content with a fallback.
export default definePage({
load: () => ({ name: "CocoFrame" }),
meta: ({ name }) => ({ title: name }),
view: ({ name }) => <h1>{name}</h1>,
});Pages own load, meta, and view. They stream unless an error boundary
intentionally buffers them. Framework boundaries use Web Request and Response.
Read docs/request-lifecycle.md; verify changes with tests/core.test.ts.
