feat: add context information to render function (#46)

This commit is contained in:
Luca Casonato
2021-08-06 18:08:48 +02:00
committed by GitHub
parent 3bce2fb8d3
commit 0777c1c7ba
9 changed files with 116 additions and 61 deletions
+2 -1
View File
@@ -94,7 +94,7 @@ export class ServerContext {
for (const page of this.#pages) {
const bundlePath = `/${page.name}.js`;
const imports = [bundleAssetUrl(bundlePath)];
routes[page.route] = async (_, match) => {
routes[page.route] = async (req, match) => {
const preloads = this.#bundler.getPreloads(bundlePath).map(
bundleAssetUrl,
);
@@ -103,6 +103,7 @@ export class ServerContext {
imports: page.runtimeJS ? imports : [],
preloads: page.runtimeJS ? preloads : [],
renderer: this.#renderer,
url: new URL(req.url),
params: match.params,
});
return new Response(body, {