You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Astro 5.x, adapters could implement their server entrypoint using `App` for standard web requests/responses, or `NodeApp` for node requests/responses.
385
+
386
+
Astro 6.0 deprecates `NodeApp` in favor of `createApp()` and new utilities: `createRequest()` and `writeResponse()`. This allows a more consistent API while preserving the same features as before. It also deprecates the `NodeAppHeadersJson` type.
387
+
388
+
#### What should I do?
389
+
390
+
If you have built an adapter, update any usage of `NodeApp` with `createApp()`:
In Astro 5.x, the `astro/app/node` exposed `loadManifest()` and `loadApp()` utilities to allow loading the SSR manifest or a `NodeApp` instance from a `URL` instance. However, these were not documented and are no longer recommended usage with the v6 Adapter API.
424
+
425
+
Astro 6.0 deprecates both functions.
426
+
427
+
#### What should I do?
428
+
429
+
If you have built an adapter, remove `loadManifest()` and replace `loadApp()` by `createApp()`:
Just like [`astro/app`](#astroapp), this module is used for rendering pages that have been prebuilt through `astro build`. This allows you to create a `NodeApp` providing all the methods available from `App` and additional methods useful for Node environments.
815
+
This module is used in conjunction with [`astro/app`](#astroapp) to convert a NodeJS `IncomingMessage` into a web-standard `Request` and stream a web-standard `Response` into a NodeJS `ServerResponse`.
816
816
817
-
The `NodeApp` constructor accepts a required SSR manifest argument, and optionally an argument to enable or disable streaming, defaulting to `true`.
Extends [`app.render()`](#apprender) to also accept [Node.js `IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) objects in addition to standard `Request` objects as the first argument. The second argument is an optional object allowing you to [control the rendering](#renderoptions).
Extends [`app.match()`](#appmatch) to also accept [Node.js `IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) objects in addition to standard `Request` objects.
856
-
857
-
```js
858
-
if(nodeApp.match(request)) {
859
-
constresponse=awaitnodeApp.render(request);
860
-
}
861
-
```
862
-
863
-
#### `nodeApp.headersMap`
864
-
865
-
<p>
866
-
867
-
**Type:** `NodeAppHeadersJson |undefined`<br />
868
-
**Default:** `undefined`<br />
869
-
<Since v="5.11.0" />
870
-
</p>
871
-
872
-
An array containing the headers configuration. Each entry maps a pathname to a list of headers that should be applied for that route. This is useful for applying headers such as CSP directives to prerendered routes.
Converts a NodeJS `IncomingMessage` into a standard `Request` object. This static method accepts an optional object as the second argument, allowing you to define if the body should be ignored, defaulting to `false`, and the [`allowedDomains`](/en/reference/configuration-reference/#securityalloweddomains).
825
+
Converts a NodeJS `IncomingMessage` into a standard `Request` object. This function accepts an optional object as the second argument, allowing you to define if the body should be ignored, defaulting to `false`, and the [`allowedDomains`](/en/reference/configuration-reference/#securityalloweddomains).
904
826
905
827
The following example creates a `Request` and passes it to `app.render()`:
Streams a web-standard `Response` into a NodeJS server response. This static method takes a `Response` object and the initial `ServerResponse` before returning a promise of a `ServerResponse` object.
847
+
Streams a web-standard `Response` into a NodeJS server response. This function takes a `Response` object and the initial `ServerResponse` before returning a promise of a `ServerResponse` object.
926
848
927
849
The following example creates a `Request`, passes it to `app.render()`, and writes the response:
0 commit comments