chore: update router to 0.0.5 (#69)

This commit is contained in:
Leo K
2021-10-21 22:58:09 +02:00
committed by GitHub
parent d1076b0ad1
commit f0b96b80c8
4 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ jobs:
run: deno lint
- name: Cache dependencies
run: deno cache --no-check src/*/deps.ts
run: deno cache --no-check src/cli/deps.ts src/runtime/deps.ts src/server/deps.ts
- name: Run tests
run: deno test -A --no-check
+3 -3
View File
@@ -187,12 +187,12 @@ export class ServerContext {
(page.handler as Handler)({
req,
match,
render: createRender(req, match.params),
render: createRender(req, match),
});
} else {
for (const [method, handler] of Object.entries(page.handler)) {
routes[`${method}@${page.route}`] = (req, match) =>
handler({ req, match, render: createRender(req, match.params) });
handler({ req, match, render: createRender(req, match) });
}
}
}
@@ -225,7 +225,7 @@ export class ServerContext {
*/
#bundleAssetRoute = (): router.MatchHandler => {
return async (_req, match) => {
const path = `/${match.params.path}`;
const path = `/${match.path}`;
const file = await this.#bundler.get(path);
let res;
if (file) {
+1 -1
View File
@@ -11,7 +11,7 @@ export { walk } from "https://deno.land/std@0.108.0/fs/walk.ts";
export { listenAndServe } from "https://deno.land/std@0.108.0/http/server.ts";
// -- router --
export * as router from "https://crux.land/router@0.0.4";
export * as router from "https://crux.land/router@0.0.5";
// -- media types --
export { lookup as mediaTypeLookup } from "https://deno.land/x/media_types@v2.10.2/mod.ts";
+2 -4
View File
@@ -9,11 +9,9 @@ export interface PageModule {
config?: PageConfig;
}
export interface HandlerContext<
T extends Record<string, string> = Record<string, string>,
> {
export interface HandlerContext {
req: Request;
match: router.MatchResult<T>;
match: Record<string, string>;
render?: () => Promise<Response>;
}