Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated server options documentation #422

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
updated server options documentation
  • Loading branch information
RafidMuhymin committed May 2, 2022
commit 314aa32ef49986d4d86428af7d811eefa5de039d
24 changes: 18 additions & 6 deletions src/pages/en/reference/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ Control the output file format of each page.

## Server Options

Customize the Astro dev server, used by both `astro dev` and `astro serve`.
Customize the Astro dev server, used by both `astro dev` and `astro preview`.

```js
{
server: {port: 1234, host: true}
server: { port: 1234, host: true }
}
```

Expand All @@ -200,7 +200,7 @@ To set different configuration based on the command run ("dev", "preview") a fun
```js
{
// Example: Use the function syntax to customize based on command
server: (command) => ({port: command === 'dev' ? 3000 : 4000})
server: (command) => ({ port: command === 'dev' ? 3000 : 4000 })
}
```

Expand All @@ -213,10 +213,16 @@ To set different configuration based on the command run ("dev", "preview") a fun
<Since v="0.24.0" />
</p>

Set which network IP addresses the dev server should listen on (i.e. non-localhost IPs).
Set which network IP addresses the server should listen on (i.e. non-localhost IPs).
- `false` - do not expose on a network IP address
- `true` - listen on all addresses, including LAN and public addresses
- `[custom-address]` - expose on a network IP address at `[custom-address]`
- `[custom-address]` - expose on a network IP address at `[custom-address]` (ex: `192.168.0.1`)

```js
{
server: { host: 192.168.0.1 }
}
```


### server.port
Expand All @@ -227,10 +233,16 @@ Set which network IP addresses the dev server should listen on (i.e. non-localh
**Default:** `3000`
</p>

Set which port the dev server should listen on.
Set which port the server should listen on.

If the given port is already in use, Astro will automatically try the next available port.

```js
{
server: { port: 8080 }
}
```


## Markdown Options

Expand Down