summaryrefslogtreecommitdiff
path: root/docs/dev.md
blob: 15687d1bbf9566664004bd01f059fe6b34a723d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Development Server

The development server comes as part of the Astro CLI. Start the server with:

```shell
astro dev
```

In your project root. You can specify an alternative

## Special routes

The dev server will serve the following special routes:

### /400

This is a custom __400__ status code page. You can add this route by adding a page component to your `src/pages` folder:

```
├── src/
│   ├── components/
│   └── pages/
│       └── 400.astro
```

For any URL you visit that doesn't have a corresponding page, the `400.astro` file will be used.

### /500

This is a custom __500__ status code page. You can add this route by adding a page component to your `src/pages` folder:

```astro
├── src/
│   ├── components/
│   └── pages/
│       └── 500.astro
```

This page is used any time an error occurs in the dev server.

The 500 page will receive an `error` query parameter which you can access with:

```
---
const error = Astro.request.url.searchParams.get('error');
---

<strong>{error}</strong>
```

A default error page is included with Astro so you will get pretty error messages even without adding a custom 500 page.