SSR / foldkit-ssr
The application in these examples
The App used across the sections above defines a post page (Model,
Message, AppRoute), Data (Remote.make), PostActions/Menu/Like
Surfaces (PostActionsAt, PostPageAt), and LoadPreferences:
ts
const AppRoute = defineRouteUnion({ Home: {}, Post: { id: Schema.String }, NotFound: {} })
const Model = Schema.Struct({
route: AppRoute,
post: Schema.Struct({
id: Schema.String,
title: Schema.String,
body: Schema.String,
excerpt: Schema.String,
publishedAt: Schema.String,
liked: Schema.Boolean,
}),
draft: Schema.String,
menuOpen: Schema.Boolean,
remote: Remote.Model,
})
const Modifiers = Schema.Struct({
shiftKey: Schema.Boolean,
ctrlKey: Schema.Boolean,
altKey: Schema.Boolean,
metaKey: Schema.Boolean,
})
const Message = defineMessageUnion({
...Remote.messages,
Liked: { id: Schema.String },
ChangedDraft: { value: Schema.String },
Renamed: { id: Schema.String, title: Schema.String },
Pressed: { key: Schema.String, modifiers: Modifiers },
})Next
- Serve SSR pages on Cloudflare Workers or Node:
foldkit-host - Make forms and search pages work with JavaScript off: Pages that work without JavaScript
- Wire Site, Remote, and SSR in one app: Site, Remote and SSR together