Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 6d77784

Browse files
committed
Merge branch 'vue-support' of github.com:fastify/universify into vue-support
2 parents c728dbb + adf8ef6 commit 6d77784

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

docs/vue/basic-setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ await server.listen(3000)
3535
The starter template's [`vite.config.js`](https://github.com/fastify/fastify-dx/blob/main/starters/vue/vite.config.js) file:
3636

3737
```js
38-
import viteReact from '@vitejs/plugin-react'
38+
import viteVue from '@vitejs/plugin-vue'
3939
import viteVueFastifyDX from 'fastify-dx-vue/plugin'
4040
import unocss from 'unocss/vite'
4141

4242
const path = fileURLToPath(import.meta.url)
4343

4444
const root = join(dirname(path), 'client')
4545
const plugins = [
46-
viteReact(),
46+
viteVue(),
4747
viteVueFastifyDX(),
4848
unocss()
4949
]

docs/vue/project-structure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ In this case, placing a file with the same name as the registered virtual module
3434

3535
[virtual-modules]: https://github.com/fastify/fastify-dx/blob/main/docs/vue/virtual-modules.md
3636

37-
The `server.js` file is your application entry point. It's the file that runs everything. It boots a Fastify server configured with [**fastify-vite**](https://github.com/fastify/fastify-vite) and **Fastify DX for React** as a renderer adapter to **fastify-vite**.
37+
The `server.js` file is your application entry point. It's the file that runs everything. It boots a Fastify server configured with [**fastify-vite**](https://github.com/fastify/fastify-vite) and **Fastify DX for Vue** as a renderer adapter to **fastify-vite**.
3838

3939
The `client/index.js` file is your Vite server entry point, it's the file that provides your client bundle (which runs in the Vite-enriched environment) to the Node.js environment where Fastify runs.
4040

@@ -54,7 +54,7 @@ The `client/pages/` directory contains your route modules, whose paths are dynam
5454

5555
[routing-config]: https://github.com/fastify/fastify-dx/blob/main/docs/vue/routing-config.md
5656

57-
The `client/layouts/` directory contains your route layout modules, which can be associated to any route. By default, `layouts/default.jsx` is used, but if you don't need to do any modifications on that file, you can safely removed as it's provided by Fastify DX in that case. The starter template also comes with `layouts/auth.jsx`, to demonstrate a more advanced use of layouts.
57+
The `client/layouts/` directory contains your route layout modules, which can be associated to any route. By default, `layouts/default.vue` is used, but if you don't need to do any modifications on that file, you can safely removed as it's provided by Fastify DX in that case. The starter template also comes with `layouts/auth.vue`, to demonstrate a more advanced use of layouts.
5858

5959
[routing-config]: https://github.com/fastify/fastify-dx/blob/main/docs/vue/routing-config.md
6060

docs/vue/route-context.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ See the [full example](https://github.com/fastify/fastify-dx/blob/main/starters/
6363

6464
This hook can be used in any Vue component to retrieve a reference to the current route context. It's modelled after the [URMA specification](https://github.com/fastify/fastify-dx/blob/main/URMA.md), with still some rough differences and missing properties in this **alpha release**.
6565

66-
By default, It includes reference to `data` — which is automatically populated if you use the `getData()` function, and `state` which hold references to the global [`reactive()`] object.
66+
By default, It includes reference to `data` — which is automatically populated if you use the `getData()` function, and `state` which hold references to the global [`reactive()`](https://vuejs.org/api/reactivity-core.html#reactive) object.
6767

6868
It automatically causes the component to be suspended if the `getData()`, `getMeta()` and `onEnter()` functions are asynchronous.
6969

@@ -90,6 +90,6 @@ context.js default function export
9090
└─ Route module
9191
```
9292

93-
First the `default` function export from `context.js` (if present) is executed. This is where you can manually feed global server data into your application by populating the global Valtio state (the route context's `state` property, which is automatically hydrated on the client.
93+
First the `default` function export from `context.js` (if present) is executed. This is where you can manually feed global server data into your application by populating the global state (the route context's `state` property, which is automatically hydrated on the client.
9494

9595
Then `getData()` runs — which populates the route context's `data` property, and is also automatically hydrated on the client. Then `getMeta()`, which populates the route context's `head` property. Then `onEnter()`, and finally your route component.

docs/vue/route-enter.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ It receives the [universal route context][route-context] as first parameter, so
1212

1313
[route-context]: https://github.com/fastify/fastify-dx/blob/main/docs/vue/route-context.md
1414

15-
```jsx
15+
```html
16+
<template>
17+
<p>No pre-rendered HTML sent to the browser.</p>
18+
</template>
19+
20+
<script>
1621
export function onEnter (ctx) {
1722
if (ctx.server?.underPressure) {
1823
ctx.clientOnly = true
1924
}
2025
}
21-
22-
export function Index () {
23-
return <p>No pre-rendered HTML sent to the browser.</p>
24-
}
26+
</script>
2527
```
2628
2729
The example demonstrates how to turn off SSR and downgrade to CSR-only, assuming you have a `pressureHandler` configured in [`underpressure`](https://github.com/fastify/under-pressure) to set a `underPressure` flag on your server instance.

0 commit comments

Comments
 (0)