0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00
astro/docs/dev.md
Matthew Phillips 41c64b30af
Move the request object from import.meta to Astro (#134)
* Move the `request` object from import.meta to Astro

This moves the `request` object to the Astro "global" (really just a render-level variable).

* Document Astro.request
2021-04-27 14:00:33 -04:00

51 lines
No EOL
1.2 KiB
Markdown

# 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 `astro/pages` folder:
```
├── astro/
│ ├── 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 `astro/pages` folder:
```astro
├── astro/
│ ├── 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.