mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-04 04:23:02 +00:00
17 lines
1.9 KiB
JSON
17 lines
1.9 KiB
JSON
{
|
|
"id": "73229d38f5739dd0b21cb8f9",
|
|
"source": "solid:signals",
|
|
"type": "github-document",
|
|
"title": "catch-all",
|
|
"content": "---\ntitle: Catch-all routes\nuse_cases: \u003e-\n 404 pages, handling invalid urls, fallback routes, error boundaries, redirect\n unknown paths\ntags:\n - '404'\n - error-pages\n - fallback\n - routing\n - wildcards\nversion: '1.0'\ndescription: \u003e-\n Create catch-all routes in SolidJS to handle 404 errors and redirect users\n from invalid URLs to proper fallback pages.\n---\n\nCatch-all routes are used to match any URL that does not match any other route in the application.\nThis is useful for displaying a 404 page or redirecting to a specific route when a user enters an invalid URL.\n\nTo create a catch-all route, place a route with an asterisk (`*`) as the path at the end of the route list.\nOptionally, you can name the parameter to access the unmatched part of the URL.\n\n```jsx\nimport { Router, Route } from \"@solidjs/router\";\n\nimport Home from \"./Home\";\nimport About from \"./About\";\nimport NotFound from \"./NotFound\";\n\nconst App = () =\u003e (\n \u003cRouter\u003e\n \u003cRoute path=\"/home\" component={Home} /\u003e\n \u003cRoute path=\"/about\" component={About} /\u003e\n \u003cRoute path=\"*404\" component={NotFound} /\u003e\n \u003c/Router\u003e\n);\n```\n\nNow, if a user navigates to a URL that does not match `/home` or `/about`, the `NotFound` component will be rendered.",
|
|
"url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/solid-router/concepts/catch-all.mdx",
|
|
"metadata": {
|
|
"path": "src/routes/solid-router/concepts/catch-all.mdx",
|
|
"repo": "solidjs/solid-docs",
|
|
"repo_url": "https://github.com/solidjs/solid-docs.git",
|
|
"size": 1224,
|
|
"source_type": "github"
|
|
},
|
|
"hash": "581140eca5b42c67df184f95386c7cf825b1ca5fdd90e95166a43bc493df05e4",
|
|
"timestamp": "2026-02-23T11:43:00.191612894+01:00"
|
|
} |