diff options
author | 2021-04-26 16:42:11 -0400 | |
---|---|---|
committer | 2021-04-26 16:42:11 -0400 | |
commit | 0ea4a986e207238bf0ac1db841b2a5d5b567d84d (patch) | |
tree | 17246b70fd1ab907887bea778790c2f150485c2a /docs/dev.md | |
parent | 87af0aead8db809ffea402cfc3619de8190c6c16 (diff) | |
download | astro-0ea4a986e207238bf0ac1db841b2a5d5b567d84d.tar.gz astro-0ea4a986e207238bf0ac1db841b2a5d5b567d84d.tar.zst astro-0ea4a986e207238bf0ac1db841b2a5d5b567d84d.zip |
Support 500 pages in the dev server (#131)
* Support 500 pages
* Document custom 400/500 pages
* Remove search from any pages not the 500 page
* fix(kitchen-sink): add snowpack.config.js
* fix(examples): add snowpack.config.js
* style: redesign built-in 500 page
Co-authored-by: Nate Moore <nate@skypack.dev>
Diffstat (limited to 'docs/dev.md')
-rw-r--r-- | docs/dev.md | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/docs/dev.md b/docs/dev.md new file mode 100644 index 000000000..7b811d7d3 --- /dev/null +++ b/docs/dev.md @@ -0,0 +1,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 `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 = import.meta.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.
\ No newline at end of file |