Files
100DaysOfCode/day50/src/entry-server.ts
2022-11-11 18:09:56 -06:00

17 lines
429 B
TypeScript

import { compileToString } from './lib/templateRenderer';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { appState, initAppState } from './main';
export let ctx = {};
export async function SSRPage(template: string) {
await initAppState();
return compileToString(template);
}
export function setContext(context: Record<string, unknown>) {
ctx = context;
}
export function getContext() {
return ctx;
}