feat: add support for middleware (#74)

This commit is contained in:
Luca Casonato
2021-11-01 13:35:41 +01:00
committed by GitHub
parent 6ecd7a680b
commit aa1e1bcdb4
7 changed files with 57 additions and 15 deletions
+5
View File
@@ -0,0 +1,5 @@
export async function handler(_req: Request, handle: () => Promise<Response>) {
const resp = await handle();
resp.headers.set("server", "fresh test server");
return resp;
}
+12 -10
View File
@@ -2,23 +2,25 @@
// This file SHOULD be checked into source version control.
// To update this file, run `fresh routes`.
import * as $0 from "./pages/index.tsx";
import * as $1 from "./pages/static.tsx";
import * as $2 from "./pages/props/[id].tsx";
import * as $3 from "./pages/books/[id].tsx";
import * as $4 from "./pages/api/get_only.ts";
import * as $0 from "./pages/_middleware.ts";
import * as $1 from "./pages/api/get_only.ts";
import * as $2 from "./pages/books/[id].tsx";
import * as $3 from "./pages/props/[id].tsx";
import * as $4 from "./pages/static.tsx";
import * as $5 from "./pages/intercept.tsx";
import * as $6 from "./pages/[name].tsx";
import * as $7 from "./pages/index.tsx";
const routes = {
pages: {
"./pages/index.tsx": $0,
"./pages/static.tsx": $1,
"./pages/props/[id].tsx": $2,
"./pages/books/[id].tsx": $3,
"./pages/api/get_only.ts": $4,
"./pages/_middleware.ts": $0,
"./pages/api/get_only.ts": $1,
"./pages/books/[id].tsx": $2,
"./pages/props/[id].tsx": $3,
"./pages/static.tsx": $4,
"./pages/intercept.tsx": $5,
"./pages/[name].tsx": $6,
"./pages/index.tsx": $7,
},
baseUrl: import.meta.url,
};