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
* doc(vite_tabs): add tabs for js/ts selection
* doc(vite_tabs): add more js/ts tabs, unified order (ts first), added filename as comments in code pieces
Useful to control response status during streaming:
37
69
38
70
-**Before response streaming** (`middleware`, `responseHeaders`): It's returning the response with 404 status and the 404 page
39
71
-**During response streaming** (`layout`, `page`, `components`): Adds the `meta` tag with `noindex`, stop rendering the page and sends a client script to replace the page to the 404 page. This redirect is for UX to display the 404 content, here the bots will no longer see that because it has the noindex. However, this soft redirect that is done on the client does not change the browsing history and does receive the 404 status. The browsers normally cache very well the pages that return status 404.
40
72
-**During a [server action](/building-your-application/data-management/server-actions):** (server events captured with actions): as the rendering has already been done and it is a post-render action, the 404 in an action acts similarly as in the middle of the streaming. The same happens if in the action instead of calling `notFound()` directly you do a rerender and the component calls `notFound()`.
41
73
42
-
#### Parameters:
74
+
#### Parameters
43
75
44
76
-`void`. _It does not support parameters._
45
77
46
-
#### Returns:
78
+
#### Returns
47
79
48
80
-`Never` does not require you to use `return notFound()` due to using the TypeScript [`never`](https://www.typescriptlang.org/docs/handbook/2/functions.html#never) type.
exportfunction ServerComponent({ name }, requestContext) {
@@ -934,6 +950,8 @@ export function ServerComponent({ name }, requestContext) {
934
950
}
935
951
```
936
952
953
+
:::
954
+
937
955
## Using Server Components in Web Components
938
956
939
957
It is not possible to use Server Components inside Web Components **directly** (with an import). However, it **is possible** to add Server Components within Web Components. But it can only be done through the prop [**children**](#children) or using [**slots**](#children).
@@ -1108,9 +1126,10 @@ All native web components can be located inside `web-components/_native` and con
Copy file name to clipboardexpand all lines: packages/docs/building-your-application/configuring/base-path.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,10 @@ To deploy a Brisa application under a sub-path of a domain you can use the `base
9
9
`basePath` allows you to set a path prefix for the application. For example, to use `/docs` instead of `''` (an empty string, the default), open `brisa.config.ts` and add the `basePath` config:
@@ -80,7 +93,10 @@ export async function POST(request: RequestContext) {
80
93
}
81
94
```
82
95
83
-
```js filename="src/api/items/route.js" switcher
96
+
==js
97
+
98
+
```js
99
+
//src/api/items/route.js
84
100
exportasyncfunctionPOST(request) {
85
101
constformData=awaitrequest.formData();
86
102
constname=formData.get("name");
@@ -89,6 +105,8 @@ export async function POST(request) {
89
105
}
90
106
```
91
107
108
+
:::
109
+
92
110
Since `formData` data are all strings, you may want to use [`zod-form-data`](https://www.npmjs.com/zod-form-data) to validate the request and retrieve data in the format you prefer (e.g. `number`).
0 commit comments