BREAKING: make render fn an option on start (#260)

This commit removes the `_render.{tj}s{x}?` file in favor of a `render` option on the `start` call in `main.ts`.
This commit is contained in:
Luca Casonato
2022-06-20 13:40:23 +02:00
committed by GitHub
parent de6c3f6ed5
commit 70d1838cad
13 changed files with 113 additions and 119 deletions
+5 -5
View File
@@ -6,24 +6,24 @@ import {
IslandModule,
MiddlewareModule,
PageModule,
RendererModule,
StartOptions,
UnknownPageModule,
} from "./types.ts";
export type {
FreshOptions,
Handler,
HandlerContext,
Handlers,
MiddlewareHandlerContext,
RenderFunction,
} from "./types.ts";
export { RenderContext } from "./render.tsx";
export type { RenderFn } from "./render.tsx";
export type { InnerRenderFunction } from "./render.tsx";
export interface Manifest {
routes: Record<
string,
| PageModule
| RendererModule
| MiddlewareModule
| AppModule
| ErrorPageModule
@@ -37,9 +37,9 @@ export { ServerContext };
export async function start(
routes: Manifest,
opts?: StartOptions,
opts: StartOptions = {},
) {
const ctx = await ServerContext.fromManifest(routes);
const ctx = await ServerContext.fromManifest(routes, opts);
console.log(
`Server listening on http://${opts?.hostname ?? "localhost"}:${
opts?.port ?? 8000