diff --git a/src/content/docs/en/reference/adapter-reference.mdx b/src/content/docs/en/reference/adapter-reference.mdx index b7ba67302e3fe..b36b55784b568 100644 --- a/src/content/docs/en/reference/adapter-reference.mdx +++ b/src/content/docs/en/reference/adapter-reference.mdx @@ -193,7 +193,7 @@ export function start(manifest) { The following methods are provided: -##### `app.render(request, routeData, locals)` +##### `app.render(request, { routeData, locals })` This method calls the Astro page that matches the request, renders it, and returns a Promise to a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) object. This also works for API routes that do not render pages. @@ -201,12 +201,10 @@ This method calls the Astro page that matches the request, renders it, and retur const response = await app.render(request); ``` -The method accepts a mandatory `request` argument, and two other optional arguments: [`routeData`](/en/reference/integrations-reference/#routedata-type-reference) and [`locals`](/en/reference/api-reference/#astrolocals). +The method accepts a mandatory `request` argument, and an optional argument for [`routeData`](/en/reference/integrations-reference/#routedata-type-reference) and [`locals`](/en/reference/api-reference/#astrolocals). Provide a value for `routeData` if you already know the route to render. Doing so will bypass the internal call to [`app.match`](#appmatchrequest) to determine the route to render. -When used, `locals` must be the third argument passed. You can pass `undefined` for `routeData` if you are not targeting a specific route. - The example below reads a header named `x-private-header`, attempts to parse it as an object and pass it to `locals`, which can then be passed to any [middleware function](/en/guides/middleware/). ```js @@ -217,7 +215,7 @@ try { locals = JSON.parse(privateHeader); } } finally { - const response = await app.render(request, undefined, locals); + const response = await app.render(request, { locals }); } ```