refactor: use manifest variable name (#1902)
Previously, the `routes` variable name was used. This change makes more sense as the variable has the `Manifest` type.
This commit is contained in:
@@ -8,7 +8,7 @@ In this page we discuss how the server can be configured during startup.
|
||||
The signature of the primary method looks like this:
|
||||
|
||||
```ts main.ts
|
||||
export async function start(routes: Manifest, opts: StartOptions = {});
|
||||
export async function start(manifest: Manifest, opts: StartOptions = {});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
+4
-4
@@ -85,17 +85,17 @@ export interface Manifest {
|
||||
export { ServerContext };
|
||||
|
||||
export async function createHandler(
|
||||
routes: Manifest,
|
||||
manifest: Manifest,
|
||||
opts: StartOptions = {},
|
||||
): Promise<
|
||||
(req: Request, connInfo?: ServeHandlerInfo) => Promise<Response>
|
||||
> {
|
||||
const ctx = await ServerContext.fromManifest(routes, opts);
|
||||
const ctx = await ServerContext.fromManifest(manifest, opts);
|
||||
return ctx.handler();
|
||||
}
|
||||
|
||||
export async function start(routes: Manifest, opts: StartOptions = {}) {
|
||||
const ctx = await ServerContext.fromManifest(routes, {
|
||||
export async function start(manifest: Manifest, opts: StartOptions = {}) {
|
||||
const ctx = await ServerContext.fromManifest(manifest, {
|
||||
...opts,
|
||||
skipSnapshot: false,
|
||||
dev: false,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
|
||||
await start(routes, options);
|
||||
await start(manifest, options);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
|
||||
// this just exists to function as a type check to assert that we can actually pass a key and cert in
|
||||
await start(routes, { ...options, key: "test", cert: "test" });
|
||||
await start(manifest, { ...options, key: "test", cert: "test" });
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import "./polyfill_deno_deploy.ts";
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
|
||||
await start(routes, options);
|
||||
await start(manifest, options);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
await start(manifest);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
await start(manifest);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
await start(manifest);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
await start(manifest);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
await start(manifest);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
await start(manifest);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
const TEST_CONFIG_SERVER = Deno.env.get("TEST_CONFIG_SERVER") === "true";
|
||||
const onListen = (params: { hostname: string; port: number }) => {
|
||||
@@ -17,7 +17,7 @@ const onListen2 = (params: { hostname: string; port: number }) => {
|
||||
console.log(`http://localhost:${params.port}`);
|
||||
};
|
||||
|
||||
await start(routes, {
|
||||
await start(manifest, {
|
||||
server: {
|
||||
onListen: TEST_CONFIG_SERVER ? onListen2 : undefined,
|
||||
},
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
await start(manifest);
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
|
||||
import "./polyfill_deno_deploy.ts";
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
await start(manifest);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(routes);
|
||||
await start(manifest);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
|
||||
await start(routes, options);
|
||||
await start(manifest, options);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import "./polyfill_deno_deploy.ts";
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
|
||||
await start(routes, options);
|
||||
await start(manifest, options);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import routes from "./fresh.gen.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
|
||||
await start(routes, options);
|
||||
await start(manifest, options);
|
||||
|
||||
Reference in New Issue
Block a user