refactor: centralize server into ServerContext (#26)

This commit centralizes all server related logic into a central
ServerContext class.
This commit is contained in:
Luca Casonato
2021-06-10 20:46:10 +02:00
committed by GitHub
parent 78c144641c
commit 572b8123c4
9 changed files with 236 additions and 224 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
import { createDefaultRouter, processRoutes } from "../server.ts";
import { router as r, ServerContext } from "../server.ts";
import { assert, assertEquals, assertStringIncludes } from "./deps.ts";
import routes from "./fixture/routes.gen.ts";
const router = createDefaultRouter(...processRoutes(routes));
const router = r.router(ServerContext.fromRoutes(routes).routes());
Deno.test("/ page prerender", async () => {
const resp = await router(new Request("https://fresh.deno.dev/"));