SSR / foldkit-ssr
The application in these examples
A post page. App is Surface.application({ Model, Message, initial, update
}). The Surfaces (PostActions, Menu, Like), Data (a Remote.make
domain over App.model.remote) and LoadPreferences (a Command.define) are
the application's own. PostActionsAt and PostPageAt are Surfaces placed
for a plan, as Surface.when(PostActions, App.model.route, AppRoute.Post, route
=> ({ id: route.id })) places one in
the coverage example.
ts
const AppRoute = defineRouteUnion({ Home: {}, Post: { id: Schema.String } })
const Model = Schema.Struct({
route: AppRoute,
post: Schema.Struct({
id: Schema.String,
title: Schema.String,
body: 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 },
})See also
- What the tests prove.
- What this package asks of Foldkit.
- Site, Remote and SSR together: a routed application rendered with its server data, taken over, and built statically.