Skip to content

Commit

Permalink
docs: update config with alphabetical order
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Nov 12, 2024
1 parent 92e7591 commit ee5e97f
Showing 1 changed file with 112 additions and 113 deletions.
225 changes: 112 additions & 113 deletions docs/content/docs/1.getting-started/3.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,94 +13,6 @@ export default defineNuxtConfig({
})
```

## `database`

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.

Here is the list of supported database adapters:

### `SQLite`

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.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
content: {
database: {
type: 'sqlite',
binding: 'SQLITE_DB_LOCATION'
}
}
})
```

### `D1`

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.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
content: {
database: {
type: 'd1',
binding: 'CF_BINDING_NAME'
}
}
})
```

### `Postgres`

If you plan to deploy your application using PostgreSql database you need to use `postgres` database adapter.

First, make sure to install the `pg` package:

```bash [Terminal]
npx nypm i pg
```

Then, configure the `postgres` adapter in your `nuxt.config.ts`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
content: {
database: {
type: 'postgres',
url: process.env.POSTGRES_URL,
/* Other options for `pg` */
}
}
})
```

### `LibSQL`

If you plan to deploy your application using LibSQL database you need to use `libsql` database adapter.

First, make sure to install the `@libsql/client` package:

```bash [Terminal]
npx nypm i @libsql/client
```

Then, configure the `libsql` adapter in your `nuxt.config.ts`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
content: {
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
}
}
})
```

::note
The most popular LibSQL hosting services is [Turso](https://turso.tech/).
::

## `build`

Nuxt Content read and parse all the available contents at built time. This option let you control over parsing contents.
Expand Down Expand Up @@ -343,51 +255,93 @@ export default defineNuxtConfig({

Read more about adding languages in the [Shiki documentation](https://github.com/shikijs/shiki/blob/main/docs/languages.md#adding-grammar).

## `watch`
## `database`

```ts [Default]
watch: {
enabled: true,
ws: { port: 4000, showURL: false }
}
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.

Here is the list of supported database adapters:

### `SQLite`

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.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
content: {
database: {
type: 'sqlite',
binding: 'SQLITE_DB_LOCATION'
}
}
})
```

Configure content hot reload in development.
### `D1`

Value:
- `enabled`{lang=ts}: Enable/Disable hot reload.
- `port`{lang=ts}: Select the port used for the WebSocket server.
- `showURL`{lang=ts}: Toggle URL display in dev server boot message.
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.

::callout
The watcher is a development feature and will not be included in production.
::
```ts [nuxt.config.ts]
export default defineNuxtConfig({
content: {
database: {
type: 'd1',
binding: 'CF_BINDING_NAME'
}
}
})
```

::code-group
```ts [Enabled]
### `Postgres`

If you plan to deploy your application using PostgreSql database you need to use `postgres` database adapter.

First, make sure to install the `pg` package:

```bash [Terminal]
npx nypm i pg
```

Then, configure the `postgres` adapter in your `nuxt.config.ts`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
content: {
watch: {
ws: {
port: 4000,
showURL: true
}
database: {
type: 'postgres',
url: process.env.POSTGRES_URL,
/* Other options for `pg` */
}
}
})
```

```ts [Disabled]
### `LibSQL`

If you plan to deploy your application using LibSQL database you need to use `libsql` database adapter.

First, make sure to install the `@libsql/client` package:

```bash [Terminal]
npx nypm i @libsql/client
```

Then, configure the `libsql` adapter in your `nuxt.config.ts`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
content: {
watch: {
enabled: false
database: {
type: 'libsql',
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
}
}
})
```
::

::note
The most popular LibSQL hosting services is [Turso](https://turso.tech/).
::

## `renderer`

Expand Down Expand Up @@ -442,3 +396,48 @@ export default defineNuxtConfig({
}
})
```

## `watch`

```ts [Default]
watch: {
enabled: true,
ws: { port: 4000, showURL: false }
}
```

Configure content hot reload in development.

Value:
- `enabled`{lang=ts}: Enable/Disable hot reload.
- `port`{lang=ts}: Select the port used for the WebSocket server.
- `showURL`{lang=ts}: Toggle URL display in dev server boot message.

::callout
The watcher is a development feature and will not be included in production.
::

::code-group
```ts [Enabled]
export default defineNuxtConfig({
content: {
watch: {
ws: {
port: 4000,
showURL: true
}
}
}
})
```

```ts [Disabled]
export default defineNuxtConfig({
content: {
watch: {
enabled: false
}
}
})
```
::

0 comments on commit ee5e97f

Please sign in to comment.