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
By default Nuxt Content uses a local SQLite database to store and query content. If you like to use another database or you plan to deploy on Cloudflare Workers, you can modify this option.
19
-
20
-
Here is the list of supported database adapters:
21
-
22
-
### `SQLite`
23
-
24
-
If you want to change default database location and move it to elsewhere you can use `sqlite` adapter to do so. This is the default value to `database` option.
25
-
26
-
```ts [nuxt.config.ts]
27
-
exportdefaultdefineNuxtConfig({
28
-
content: {
29
-
database: {
30
-
type: 'sqlite',
31
-
binding: 'SQLITE_DB_LOCATION'
32
-
}
33
-
}
34
-
})
35
-
```
36
-
37
-
### `D1`
38
-
39
-
If you plan to deploy your application to Couldflare workers, you need to use `d1` database adapter. Create `d1` binding in Cloudflare dashboard and fill the `binding` field.
40
-
41
-
```ts [nuxt.config.ts]
42
-
exportdefaultdefineNuxtConfig({
43
-
content: {
44
-
database: {
45
-
type: 'd1',
46
-
binding: 'CF_BINDING_NAME'
47
-
}
48
-
}
49
-
})
50
-
```
51
-
52
-
### `Postgres`
53
-
54
-
If you plan to deploy your application using PostgreSql database you need to use `postgres` database adapter.
55
-
56
-
First, make sure to install the `pg` package:
57
-
58
-
```bash [Terminal]
59
-
npx nypm i pg
60
-
```
61
-
62
-
Then, configure the `postgres` adapter in your `nuxt.config.ts`:
63
-
64
-
```ts [nuxt.config.ts]
65
-
exportdefaultdefineNuxtConfig({
66
-
content: {
67
-
database: {
68
-
type: 'postgres',
69
-
url: process.env.POSTGRES_URL,
70
-
/* Other options for `pg` */
71
-
}
72
-
}
73
-
})
74
-
```
75
-
76
-
### `LibSQL`
77
-
78
-
If you plan to deploy your application using LibSQL database you need to use `libsql` database adapter.
79
-
80
-
First, make sure to install the `@libsql/client` package:
81
-
82
-
```bash [Terminal]
83
-
npx nypm i @libsql/client
84
-
```
85
-
86
-
Then, configure the `libsql` adapter in your `nuxt.config.ts`:
87
-
88
-
```ts [nuxt.config.ts]
89
-
exportdefaultdefineNuxtConfig({
90
-
content: {
91
-
database: {
92
-
type: 'libsql',
93
-
url: process.env.TURSO_DATABASE_URL,
94
-
authToken: process.env.TURSO_AUTH_TOKEN,
95
-
}
96
-
}
97
-
})
98
-
```
99
-
100
-
::note
101
-
The most popular LibSQL hosting services is [Turso](https://turso.tech/).
102
-
::
103
-
104
16
## `build`
105
17
106
18
Nuxt Content read and parse all the available contents at built time. This option let you control over parsing contents.
Read more about adding languages in the [Shiki documentation](https://github.com/shikijs/shiki/blob/main/docs/languages.md#adding-grammar).
345
257
346
-
## `watch`
258
+
## `database`
347
259
348
-
```ts [Default]
349
-
watch: {
350
-
enabled: true,
351
-
ws: { port: 4000, showURL: false }
352
-
}
260
+
By default Nuxt Content uses a local SQLite database to store and query content. If you like to use another database or you plan to deploy on Cloudflare Workers, you can modify this option.
261
+
262
+
Here is the list of supported database adapters:
263
+
264
+
### `SQLite`
265
+
266
+
If you want to change default database location and move it to elsewhere you can use `sqlite` adapter to do so. This is the default value to `database` option.
267
+
268
+
```ts [nuxt.config.ts]
269
+
exportdefaultdefineNuxtConfig({
270
+
content: {
271
+
database: {
272
+
type: 'sqlite',
273
+
binding: 'SQLITE_DB_LOCATION'
274
+
}
275
+
}
276
+
})
353
277
```
354
278
355
-
Configure content hot reload in development.
279
+
### `D1`
356
280
357
-
Value:
358
-
-`enabled`{lang=ts}: Enable/Disable hot reload.
359
-
-`port`{lang=ts}: Select the port used for the WebSocket server.
360
-
-`showURL`{lang=ts}: Toggle URL display in dev server boot message.
281
+
If you plan to deploy your application to Couldflare workers, you need to use `d1` database adapter. Create `d1` binding in Cloudflare dashboard and fill the `binding` field.
361
282
362
-
::callout
363
-
The watcher is a development feature and will not be included in production.
364
-
::
283
+
```ts [nuxt.config.ts]
284
+
exportdefaultdefineNuxtConfig({
285
+
content: {
286
+
database: {
287
+
type: 'd1',
288
+
binding: 'CF_BINDING_NAME'
289
+
}
290
+
}
291
+
})
292
+
```
365
293
366
-
::code-group
367
-
```ts [Enabled]
294
+
### `Postgres`
295
+
296
+
If you plan to deploy your application using PostgreSql database you need to use `postgres` database adapter.
297
+
298
+
First, make sure to install the `pg` package:
299
+
300
+
```bash [Terminal]
301
+
npx nypm i pg
302
+
```
303
+
304
+
Then, configure the `postgres` adapter in your `nuxt.config.ts`:
305
+
306
+
```ts [nuxt.config.ts]
368
307
exportdefaultdefineNuxtConfig({
369
308
content: {
370
-
watch: {
371
-
ws: {
372
-
port: 4000,
373
-
showURL: true
374
-
}
309
+
database: {
310
+
type: 'postgres',
311
+
url: process.env.POSTGRES_URL,
312
+
/* Other options for `pg` */
375
313
}
376
314
}
377
315
})
378
316
```
379
317
380
-
```ts [Disabled]
318
+
### `LibSQL`
319
+
320
+
If you plan to deploy your application using LibSQL database you need to use `libsql` database adapter.
321
+
322
+
First, make sure to install the `@libsql/client` package:
323
+
324
+
```bash [Terminal]
325
+
npx nypm i @libsql/client
326
+
```
327
+
328
+
Then, configure the `libsql` adapter in your `nuxt.config.ts`:
329
+
330
+
```ts [nuxt.config.ts]
381
331
exportdefaultdefineNuxtConfig({
382
332
content: {
383
-
watch: {
384
-
enabled: false
333
+
database: {
334
+
type: 'libsql',
335
+
url: process.env.TURSO_DATABASE_URL,
336
+
authToken: process.env.TURSO_AUTH_TOKEN,
385
337
}
386
338
}
387
339
})
388
340
```
389
-
::
390
341
342
+
::note
343
+
The most popular LibSQL hosting services is [Turso](https://turso.tech/).
0 commit comments