chore: update router to 0.0.5 (#69)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user