+
+
+ );
+}
diff --git a/docs/components/sections/meta-framework.tsx b/docs/components/sections/meta-framework.tsx
new file mode 100644
index 000000000..1910cdd5a
--- /dev/null
+++ b/docs/components/sections/meta-framework.tsx
@@ -0,0 +1,43 @@
+import { LegoSVG } from "~/components/icons/lego-icon";
+import { NesterBox, NestItem } from "../nested-grid";
+import { SectionTitle } from "../ui/section-title";
+
+export function MetaFramework() {
+ return (
+
+
+ Composable Meta-framework
+
+ SolidStart integrates multiple separate packages to provide a complete functionality. Each
+ of these pieces can be replaced with your own implementation.
+
+ Avoid waterfalls when updating data on the server.
+
+
+ E.g.: when updating your view after a mutation, SolidStart will
+ prevent a waterfall even if a navigation is triggered by the
+ mutation. New data comes on the same flight as the mutation
+ response.
+
+
+
+
+ During a roundtrip 2 identical requests never fly out, and 2
+ identical resources are never serialized again.
+
+
+
+
+ Form actions running on the server with code co-location and all the
+ bells, whisltles, and whimsy you need.
+
+
+
+
+ Also known as Lambda Functions, SolidStart can create these API
+ endpoints automatically, just as any other route.
+
+
+
+ Data (pre-)Loading
+
+ }
+ >
+
+ Strongly parallelized data loading, easily define preloading
+ strategies and empower your users with the snappiest UX they can
+ imagine!
+
-
-
-
-## Usage
-
-### Using file-based routing to set up your `Router`
-
-The `` component collects routes from the file-system in the `/routes` folder to be inserted into a parent `` component.
-
-Since `FileRoutes` returns a route configuration, it must be placed directly inside a ``, usually the one in your `app.tsx` file.
-
-```tsx twoslash {7-9} filename="app.tsx"
-import { Suspense } from "solid-js";
-import { Router } from "@solidjs/router";
-import { FileRoutes } from "@solidjs/start/router";
-
-export default function App() {
- return (
- {props.children}}>
-
-
- );
-}
-```
-
-
-
-See the [routing guide](/core-concepts/routing) for more details.
-
-[route]: /api/Route
diff --git a/docs/routes/api/GET.md b/docs/routes/api/GET.md
deleted file mode 100644
index 764319f54..000000000
--- a/docs/routes/api/GET.md
+++ /dev/null
@@ -1,25 +0,0 @@
----
-section: api
-title: GET
-order: 99
-subsection: Server
-active: true
----
-# GET
-`GET` allows one to create a server function which is accessed via an [HTTP GET request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET). When this function is called, the arguments are serialized into the url, thus allowing the use of [HTTP cache-control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) headers.
-
-## Usage
-Example with streaming promise and a 60 second cache life
-
-```tsx twoslash {4, 8}
-import { json } from "@solidjs/router";
-import { GET } from "@solidjs/start";
-
-const hello = GET(async (name: string) => {
- "use server";
- return json(
- { hello: new Promise(r => setTimeout(() => r(name), 1000)) },
- { headers: { "cache-control": "max-age=60" } }
- );
-});
-```
\ No newline at end of file
diff --git a/docs/routes/api/HttpHeader.md b/docs/routes/api/HttpHeader.md
deleted file mode 100644
index 2630335a1..000000000
--- a/docs/routes/api/HttpHeader.md
+++ /dev/null
@@ -1,63 +0,0 @@
----
-section: api
-title: HttpHeader
-order: 10
-subsection: Document
-active: true
----
-
-# HttpHeader
-
-##### `HttpHeader` is a component that allows you set a header on the HTTP response sent by the server.
-
-
-
-
-
-## Usage
-
-### Setting a header for catch-all routes
-
-```tsx twoslash filename="routes/*404.tsx"
-import { HttpHeader, HttpStatusCode } from "@solidjs/start";
-
-export default function NotFound() {
- return (
-
-
-
-
- );
-}
-```
-
-As you render the page you may want to add additional HTTP headers to the response. The `HttpHeader` component will do that for you. You can pass it a `name` and `value` and that will get added to the `Response` headers sent back to the browser.
-
-Keep in mind, when streaming responses(`renderStream`), HTTP headers can only be included that are added before the stream first flushed. Be sure to add `deferStream` to any resources that needed to be loaded before responding.
-
-## Reference
-
-### ``
-
-Import from `"@solidjs/start"` and use it anywhere in your component tree. It will add the header if that part of the tree is rendered on the server.
-
-```tsx twoslash
-import { HttpHeader } from "@solidjs/start";
-
-function Component() {
- return ;
-}
-```
-
-#### Props
-
-- `name` - The name of the header to set
-- `value` - The value of the header to set
diff --git a/docs/routes/api/HttpStatusCode.md b/docs/routes/api/HttpStatusCode.md
deleted file mode 100644
index 42996b37f..000000000
--- a/docs/routes/api/HttpStatusCode.md
+++ /dev/null
@@ -1,82 +0,0 @@
----
-section: api
-title: HttpStatusCode
-order: 11
-subsection: Document
-active: true
----
-
-# HttpStatusCode
-
-##### `HttpStatusCode` is a component that sets the HTTP status code for the page response while server-side rendering.
-
-
-
-
-
-## Usage
-
-### Setting a 404 status code for the unmatched routes
-
-As you render the page you may want to set the status code to the `Response` depending on how it goes. The `HttpStatusCode` component will do that for you. You can pass `code` and that will be set as the `Response` status sent back to the browser.
-
-Since `HttpStatusCode` is just a component, it can be used with `ErrorBoundaries`, `Show`, `Switch` or any of the other JSX control-flow components. So the same logic you are using to decide what to render should inform what status code you are setting. This allows that logic to sit together.
-
-Status codes are important tools for things like caching and SEO, so it's a good practice to send meaningful status codes. For example, for a `NotFound` page, you should send a `404` status code.
-
-```tsx twoslash {6} filename="routes/*404.tsx"
-import { HttpStatusCode } from "@solidjs/start";
-
-export default function NotFound() {
- return (
-
-
-
Page not found
-
- );
-}
-```
-
-### Setting a 404 status code for missing pages for dynamic routes
-
-When you use dynamic params in routes, you may want to set a 404 status code if the given parameter for a segment points to a missing resource. Usually, you will find out that the param is missing when you do some async request with that param. You are probably inside a resource fetcher.
-
-You can throw errors from inside these fetchers. These will be caught by the nearest `` component from where the data is accessed. `` pairs very well with error boundaries. You can inspect the error in the ErrorBoundary's fallback. If the fetcher throws an error indicating the data was not found, render a ``.
-
-Keep in mind, when streaming responses (`renderStream`), the HTTP Status can only be included if added before the stream first flushed. Be sure to add `deferStream` to any resources calls that need to be loaded before responding.
-
-```tsx twoslash {7,17-19, 15, 23} filename="routes/[house].tsx"
-import { Show, ErrorBoundary } from "solid-js";
-import { cache, createAsync } from "@solidjs/router";
-import { HttpStatusCode } from "@solidjs/start";
-
-const getHouse = cache(async (house: string) => {
- if (house != "gryffindor") {
- throw new Error("House not found");
- }
- return house;
-}, "house");
-
-export default function House(props: { name: string }) {
- const house = createAsync(() => getHouse(props.name), { deferStream: true });
- return (
- (
-
-
-
- )}
- >
-
{house()}
-
- );
-}
-```
diff --git a/docs/routes/api/RequestEvent.md b/docs/routes/api/RequestEvent.md
deleted file mode 100644
index 9b757daeb..000000000
--- a/docs/routes/api/RequestEvent.md
+++ /dev/null
@@ -1,75 +0,0 @@
----
-section: api
-title: RequestEvent
-order: 99
-subsection: Server
-active: true
----
-
-# RequestEvent
-
-Solid uses Async Local Storage on the server as a way of injecting the request context anywhere on the server. This is also the event that shows up in middleware.
-
-It can be retrieved via the `getRequestEvent` call from `"solid-js/web"`. That is right the core event is available in libraries as well but we extend it for SolidStart's purposes.
-
-```js
-import { getRequestEvent } from "solid-js/web";
-
-const event = getRequestEvent();
-```
-
-## Request
-
-The most important property of the `RequestEvent` is `.request`. This is a Web [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object that represents the current request to the server. You can access all the properties off of it like `url` and `headers`. The `body` usually does not need to be handled directly for things like server functions or rendering which already handle mapping it.
-
-```js
-import { getRequestEvent } from "solid-js/web";
-
-const event = getRequestEvent();
-if (event) {
- const auth = event.request.headers.get("Authorization")
-}
-```
-
-## Response
-
-The `RequestEvent` also can be used to stub out the Response. We extend the options that one would pass to the [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#options) constructor. This is kept up to date so it can be used to read and write headers and status for the current response.
-
-```js
-import { getRequestEvent } from "solid-js/web";
-
-const event = getRequestEvent();
-if (event) {
- event.response.headers.append("Set-Cookie", "foo=hello");
- event.response.status = 201;
-}
-```
-
-### Returning a Response vs updating the Response on the event
-
-The event is considered global and lasts the life of the request. Therefore whether you are calling a server function on the server during SSR or via an RPC call setting values on `event.response` will reflect on that request.
-
-Whereas the returned response will only impact the response when it is an RPC call. This is important because some headers you might want to set you may not want to set for the whole page and only for the specific request.
-
-Keep this in mind when choosing where to set headers and responses.
-
-## Locals
-
-SolidStart uses `event.locals` to pass around local context to be used as you see fit.
-
-When adding fields to `event.locals`, you can let Typescript know the types of these fields like so:
-
-```tsx
-declare module "@solidjs/start/server" {
- interface RequestEventLocals {
- myNumber: number;
- someString: string;
- }
-}
-```
-
-## nativeEvent
-
-Sometimes you still need access to the underlying event from Vinxi. You can access that using the `.nativeEvent` property. It is the underlying H3Event used and can be passed to the helpers available in the ecosystem. Keep in mind that Vinxi HTTP helpers do not treeshake so you can only import them in files that do not contain client or isomorphic code.
-
-Many of these events support Async Local Storage so this may not be needed.
diff --git a/docs/routes/api/ReturnResponses.md b/docs/routes/api/ReturnResponses.md
deleted file mode 100644
index 62a23f142..000000000
--- a/docs/routes/api/ReturnResponses.md
+++ /dev/null
@@ -1,60 +0,0 @@
----
-section: api
-title: Returning Responses
-order: 99
-subsection: Server
-active: true
----
-
-# Returning Responses
-
-In SolidStart it's possible to return a Response object from a server function. `@solidjs/router` knows how to handle certain responses with its `cache` and `action` APIs. For Typescript ergonomics, when returning a response using `@solidjs/router`'s `redirect`, `reload`, or `json` helpers, they will not impact the return value of the server function.
-
-You can always return or throw a response but we suggest that depending on the type of function to handle errors differently.
-
-
-
cache
action
-
return
data, response
success message, error, response
-
throw
error, response
response
-
-
-## Examples
-
-In the following example, as far as Typescript is concerned, the `hello` function will return a value of type `Promise<{ hello: Promise }>`
-
-```tsx twoslash
-import { json } from "@solidjs/router";
-import { GET } from "@solidjs/start";
-
-const hello = GET(async (name: string) => {
- "use server";
- return json(
- { hello: new Promise(r => setTimeout(() => r(name), 1000)) },
- { headers: { "cache-control": "max-age=60" } }
- );
-});
-```
-
-
-In this next example, because `redirect` and `reload` return `never` that means the `getUser` function can only return a value of type `Promise`
-
-```tsx { 4, 10, 14}
-export async function getUser() {
- "use server"
-
- const session = await getSession();
- const userId = session.data.userId;
- if (userId === undefined) return redirect("/login");
-
- try {
- const user: User = await db.user.findUnique({ where: { id: userId } });
-
- // throwing here could have been a bit awkward.
- if (!user) return redirect("/login");
- return user;
- } catch {
- // do stuff
- throw redirect("/login");
- }
-}
-```
\ No newline at end of file
diff --git a/docs/routes/api/app-config.md b/docs/routes/api/app-config.md
deleted file mode 100644
index 251151aa1..000000000
--- a/docs/routes/api/app-config.md
+++ /dev/null
@@ -1,125 +0,0 @@
----
-section: api
-title: app.config.ts
-order: 8
-subsection: Entrypoints
-active: true
----
-
-# app.config.ts
-
-##### `app.config.ts` is where you configure your application.
-
-
-
-
-
-## Usage
-
-### Configuring your application
-
-SolidStart is built on top of [Vinxi](https://vinxi.vercel.app/) which combines the power of [Vite](https://vitejs.dev) and [Nitro](https://nitro.unjs.io).
-
-The core configuration used by SolidStart is found at `@solidjs/start/config`.
-
-SolidStart supports most vite options, including plugins via the `vite` option:
-
-```tsx
-import { defineConfig } from "@solidjs/start/config";
-
-export default defineConfig({
- vite: {
- // vite options
- plugins: []
- }
-});
-```
-
-The `vite` option can also be a function which can be customized for each Vinxi router. In SolidStart we use 3, `server` for SSR, `client` for the browser, and `server-function` for server functions.
-
-```tsx
-import { defineConfig } from "@solidjs/start/config";
-
-export default defineConfig({
- vite({ router }) {
- if (router === "server") {
- } else if (router === "client") {
- } else if (router === "server-function") {
- }
- return { plugins: [] };
- }
-});
-```
-
-SolidStart uses Nitro which can run on a number of platforms. The `server` option exposes some Nitro options including deployment presets.
-
-- Node
-- Static hosting
-- Netlify Functions & Edge
-- Vercel Functions & Edge
-- AWS Lambda & Lambda@Edge
-- Cloudflare Workers & Pages
-- Deno Deploy
-
-The simplest usage is passing no arguments, which defaults to the Node preset. Some presets may be autodetected by the provider. Otherwise they must added to the configuration via the `server.preset` option. For example, this uses Netlify Edge:
-
-```tsx
-import { defineConfig } from "@solidjs/start/config";
-
-export default defineConfig({
- server: {
- preset: "netlify_edge"
- }
-});
-```
-
-#### Special Note
-
-SolidStart uses Async Local Storage. Not all non-node platforms support it out of the box. Netlify, Vercel, and Deno should just work. But for Cloudflare you will need specific config:
-
-```js
-import { defineConfig } from "@solidjs/start/config";
-
-export default defineConfig({
- server: {
- preset: "cloudflare_module",
- rollupConfig: {
- external: ["__STATIC_CONTENT_MANIFEST", "node:async_hooks"]
- }
- }
-});
-```
-
-And enable node compat in your wrangler.toml.
-
-```
-compatibility_flags = [ "nodejs_compat" ]
-```
-
-## Reference
-
-### `@solidjs/start/config`
-
-The vite options are same as the default with exception of the `start` property exposes the following options:
-
-- `server` (_object_): Nitro server config options
-- `appRoot` (_string_, default `"./src"`): Sets the root of the application code.
-- `routesDir` (_string_, default `"./routes"`): The path to where the routes are located.
-- `ssr` (_boolean_ | "sync" | "async", default `true`): Providing a boolean value will toggle between client rendering and [streaming](https://docs.solidjs.com/references/concepts/ssr/streaming) server rendering (ssr) mode, while "sync" and "async" will render using Solid's [renderToString](https://docs.solidjs.com/references/concepts/ssr/simple-client-fetching-ssr) and [renderToStringAsync](https://docs.solidjs.com/references/concepts/ssr/async-ssr) respectively.
-- `experimental.islands` (_boolean_, default `false`): _experimental_ toggles on "islands" mode.
diff --git a/docs/routes/api/app.md b/docs/routes/api/app.md
deleted file mode 100644
index 86112071e..000000000
--- a/docs/routes/api/app.md
+++ /dev/null
@@ -1,49 +0,0 @@
----
-section: api
-title: app.tsx
-order: 8
-subsection: Entrypoints
-active: true
----
-
-# app.tsx
-
-##### `app.tsx` defines the document that your application renders.
-
-
-
-```tsx twoslash
-import { MetaProvider, Title } from "@solidjs/meta";
-import { Router } from "@solidjs/router";
-import { FileRoutes } from "@solidjs/start/router";
-import { Suspense } from "solid-js";
-
-export default function App() {
- return (
- (
-
- SolidStart - Basic
- Index
- About
- {props.children}
-
- )}
- >
-
-
- );
-}
-```
-
-
-
-
-
-## Usage
-
-### Setting up your application
-
-The `App` component exported from `app.tsx` is the isomorphic (shared on server and browser) entry into your application. This is the point where the code runs on both sides. This is like the classic entry point you would find in Create React App or similar, where you can define your router, and other top level components.
-
-Our basic example (as shown above) includes `@solidjs/router` and `@solidjs/meta`. But this can really be whatever you want.
diff --git a/docs/routes/api/clientOnly.md b/docs/routes/api/clientOnly.md
deleted file mode 100644
index bacf7f7ad..000000000
--- a/docs/routes/api/clientOnly.md
+++ /dev/null
@@ -1,53 +0,0 @@
----
-section: api
-title: clientOnly
-order: 99
-subsection: Server
-active: true
----
-
-# "clientOnly"
-
-Wrap Components that are only to be rendered in the Client. Helpful for components that can never server render because they interact directly with the DOM. It works similar to `lazy` except it only renders after hydration and never loads on the Server.
-
-
-
-
-
-## Usage
-
-### Basic usage
-
-You may have a component that has some sort of client based side effect like writing or reading something from the document. Maybe some legacy jQuery code etc. To use `clientOnly` first isolate the code in a file.
-
-```tsx twoslash
-const location = window.document.location;
-
-export default function ClientOnlyComponent() {
- return
{location.href}
;
-}
-```
-
-And then import dynamically using `clientOnly`.
-
-```tsx
-import { clientOnly } from "@solidjs/start";
-
-const ClientOnlyComp = clientOnly(() => import("../ClientOnlyComp"));
-
-function IsomorphicComp() {
- return ;
-}
-```
diff --git a/docs/routes/api/entry-client.md b/docs/routes/api/entry-client.md
deleted file mode 100644
index 9901e8dcc..000000000
--- a/docs/routes/api/entry-client.md
+++ /dev/null
@@ -1,52 +0,0 @@
----
-section: api
-title: entry-client.tsx
-order: 8
-subsection: Entrypoints
-active: true
----
-
-# entry-client.tsx
-
-##### `entry-client.tsx` is where your app starts in the browser.
-
-
-
-
-
-## Usage
-
-### Mounting your application
-
-This file does one thing. It starts your SolidStart application in the browser. It does so by passing in our `` to a `mount` function that also takes our mount element as an argument. What is `mount`? It is an alias over Solid's `hydrate` and `render` methods to ensure that no matter what the client always starts up properly.
-
-It doesn't matter if you are using SolidStart to do client-only rendering or if you are using our various modes of server-side rendering. This file is good place to run any other client specific code that you want to happen on startup. Things like registering service workers.
-
-## Reference
-
-### `mount(codeFn, mountEl)`
-
-Method that either calls `render` or `hydrate` depending on the configuration.
-
-```tsx twoslash
-import { mount, StartClient } from "@solidjs/start/client";
-
-mount(() => , document.getElementById("app")!);
-```
-
-#### Parameters
-
-- `codeFn` (_function_): function that executes the application code
-- `mountEl` (_Node_ | _Document_): element to mount the application to
-
-### ``
-
-Component that wraps our application root.
diff --git a/docs/routes/api/entry-server.md b/docs/routes/api/entry-server.md
deleted file mode 100644
index fecc23cd7..000000000
--- a/docs/routes/api/entry-server.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-section: api
-title: entry-server.tsx
-order: 8
-subsection: Entrypoints
-active: true
----
-
-# entry-server.tsx
-
-##### `entry-server.tsx` is where your app starts on the server.
-
-
-
-
-
-## Usage
-
-### Rendering your application
-
-This file does one thing. It starts your SolidStart application on the server. It does so by passing in our `` to a "render" function. `` takes a document component which will serve as the static document for your application.
-
-## Reference
-
-### `createHandler(renderFn, options)`
-
-This calls the underlying Solid render function, and passes the options to it.
-
-### ``
-
-Component that wraps our application root.
diff --git a/docs/routes/api/index.mdx b/docs/routes/api/index.mdx
deleted file mode 100644
index e0f9b4030..000000000
--- a/docs/routes/api/index.mdx
+++ /dev/null
@@ -1,10 +0,0 @@
----
-section: api
-sectionTitle: API Reference
-hidden: true
-sectionOrder: 4
----
-
-import { Navigate } from "@solidjs/router";
-
-
diff --git a/docs/routes/api/server.md b/docs/routes/api/server.md
deleted file mode 100644
index 7b90a6cf7..000000000
--- a/docs/routes/api/server.md
+++ /dev/null
@@ -1,69 +0,0 @@
----
-section: api
-title: use server
-order: 100
-subsection: Server
-active: true
----
-
-# "use server"
-
-Perform actions on the server environment only (i.e. console logging, etc.).
-
-
-
-
-
-## Usage
-
-### Basic usage
-
-To create a function that only runs on the server, insert `"use server"` directive at the top of the function.
-
-```tsx twoslash {2}
-const logHello = async (message: string) => {
- "use server";
- console.log(message);
-};
-
-logHello("Hello");
-```
-
-In this example, regardless of whether we are rendering this on the server or in the browser, the `logHello` function generates a log on the server console only. How does it work? We use compilation to transform the `use server` function into an RPC call to the server.
-
-### Serialization
-
-Server functions allow the serialization of many different data types in the response. The full list is available [here](https://github.com/lxsmnsyc/seroval/blob/main/docs/compatibility.md#supported-types).
-
-### Meta information
-
-Depending on your hosting, the server function might be running in parallel on multiple cpu cores or workers. You can use `getServerFunctionMeta` to retrieve a function-specific `id`, which is stable across all instances.
-
-Keep in mind: this `id` can and will change between builds!
-
-```tsx twoslash
-import { getServerFunctionMeta } from "@solidjs/start/server";
-
-// or some in-memory db
-const appCache: any = globalThis;
-
-const counter = async () => {
- "use server";
- const { id } = getServerFunctionMeta()!;
- const key = `counter_${id}`;
- appCache[key] = appCache[key] ?? 0;
- appCache[key]++;
-
- return appCache[key] as number;
-};
-```
diff --git a/docs/routes/core-concepts/actions.md b/docs/routes/core-concepts/actions.md
deleted file mode 100644
index 9f8114838..000000000
--- a/docs/routes/core-concepts/actions.md
+++ /dev/null
@@ -1,150 +0,0 @@
----
-section: core-concepts
-title: Actions
-order: 7
----
-
-# Actions
-
-One question you will likely have when developing any sort of app is "how do I communicate new information to my server?". The user did something. What next? Solid Router's answer to this is _actions_.
-
-Actions give you the ability to specify an async action processing function and gives you elegant tools to help you easily manage and track submissions. Actions are isomorphic and represent a `POST` request.
-
-Actions are isomorphic. This means that a submission can be handled on the server _or_ the client, whichever is optimal. They represent the server component of an [HTML form](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form), and even help you use HTML forms to submit data.
-
-## Creating actions
-
-Let's stop getting ahead of ourselves! First, let's create an action!
-
-```tsx twoslash
-import { action, useAction } from "@solidjs/router";
-
-const echo = action(async (message: string) => {
- // Imagine this is a call to fetch
- await new Promise((resolve, reject) => setTimeout(resolve, 1000));
- console.log(message);
-});
-
-export function MyComponent() {
- const myEcho = useAction(echo);
-}
-```
-
-This `echo` action will act as your backend, however you can substitute it for any API, provided you are ok with it running on the client. Typically, route actions are used with some sort of solution like fetch or GraphQL.
-
-These will return either a `Response` such as a redirect (we are not returning anything quite yet!) or any value. If you want to ensure the action only runs on the server for things like databases, you will want to use `"use server"`, introduced below.
-
-Naturally, this action won't do anything quite yet. We still need to call it somewhere! For now, let's call it manually from some component using the submit function returned from `action`.
-
-```tsx twoslash
-import { action, useAction } from "@solidjs/router";
-
-const echo = action(async (message: string) => {
- // Imagine this is a call to fetch
- await new Promise((resolve, reject) => setTimeout(resolve, 1000));
- console.log(message);
-});
-
-export function MyComponent() {
- const myEcho = useAction(echo);
- myEcho("Hello from solid!");
-}
-```
-
-You should see `Hello from solid!` back in the console!
-
-### Returning from actions
-
-In many cases, after submitting data the server sends some data back as well. Usually an error message if something failed. Anything returned from your action function can be accessed using the reactive `action.result` property. The value of this property can change each time you submit your action.
-
-```tsx twoslash
-import { action, useAction, useSubmission } from "@solidjs/router";
-
-const echo = action(async (message: string) => {
- await new Promise((resolve, reject) => setTimeout(resolve, 1000));
- return message;
-});
-
-export function MyComponent() {
- const myEcho = useAction(echo);
- const echoing = useSubmission(echo);
- myEcho("Hello from solid!");
- setTimeout(() => myEcho("This is a second submission!"), 1500);
- return
{echoing.result}
;
-}
-```
-
-While this method of using actions works, it leaves the implementation details of how you trigger `echo` up to you. When handling explicit user input, it's better to use a `form` for a multitude of reasons.
-
-## Using forms to submit data
-
-We highly recommend using HTML forms as your method to submit data with actions. HTML forms can be used even before JavaScript loads, leading to instantly interactive applications.
-
-They have the added benefit of implicit accessibility. They can save you valuable time that would have otherwise been spent designing a UI library that will never have the aforementioned benefits.
-
-When forms are used to submit actions, the first argument is an instance of [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData). To write a form using actions, pass the action to the action property of your form. You can then walk away with amazing, progressively enhanced forms!
-
-If you don't return a `Response` from your action, the user will stay on the same page and your resources will be re-triggered. You can also throw a `redirect` to tell the browser to navigate.
-
-```tsx twoslash
-import { action, redirect } from "@solidjs/router";
-
-const isAdmin = action(async (formData: FormData) => {
- await new Promise((resolve, reject) => setTimeout(resolve, 1000));
- const username = formData.get("username");
- if (username === "admin") throw redirect("/admin");
- return new Error("Invalid username");
-});
-
-export function MyComponent() {
- return (
-
- );
-}
-```
-
-## Server Actions
-
-Sometimes we need to make sure our action _only_ runs on the server. This is useful for:
-
-- Accessing internal APIs.
-- Proxying external APIs.
- - To use server secrets.
- - To reduce the response payload by postprocessing.
- - To bypass CORS.
-- Running code incompatible with browsers.
-- Or even connecting directly to a database. (Take caution, opinions on if this is a good idea are mixed. You should consider separating your backend and frontend).
-
-To do this, put a `"use server";` directive in your action function:
-
-```tsx twoslash {4}
-import { action, redirect } from "@solidjs/router";
-
-const isAdmin = action(async (formData: FormData) => {
- "use server";
- await new Promise((resolve, reject) => setTimeout(resolve, 1000));
- const username = formData.get("username");
- if (username === "admin") throw redirect("/admin");
- return new Error("Invalid username");
-});
-
-export function MyComponent() {
- return (
-
- );
-}
-```
-
-## Error Handling
-
-We strongly recommend with actions to "return" errors rather than throwing them. This can help with typing of submissions you'd use with `useSubmission`. This is important especially for handling progressive enhancement where no JS is present in the client so that we can use the error declaratively to render the updated page on the server.
-
-Additionally when using Server Actions it is good practice to try to handle errors on the server so that you can sanitize error messages.
\ No newline at end of file
diff --git a/docs/routes/core-concepts/api-routes.md b/docs/routes/core-concepts/api-routes.md
deleted file mode 100644
index f6fa51c7b..000000000
--- a/docs/routes/core-concepts/api-routes.md
+++ /dev/null
@@ -1,223 +0,0 @@
----
-section: core-concepts
-title: API Routes
-order: 8
-active: true
----
-
-# API Routes
-
-
-
-While we think that using `Server Functions` is the best way to write server-side code for data needed by your UI, sometimes you need to expose API routes. Reasons for wanting API Routes include:
-
-- You have additional clients that want to share this logic.
-- You want to expose a GraphQL or tRPC endpoint.
-- You want to expose a public facing REST API.
-- You need to write webhooks or auth callback handlers for OAuth.
-- You want to have URLs not serving HTML, but other kinds of documents like PDFs or images.
-
-SolidStart makes it easy to write routes for these use cases.
-
-> **Note:** API routes are always prioritized over page route alternatives. If you want to have them overlap at the same path remember to use `Accept` headers. Returning without a response in `GET` route will fallback to page route handling.
-
-## Writing an API Route
-
-API routes are just like any other route and follow the same filename conventions as [UI Routes][routing]. The only difference is in what you should export from the file. API Routes do not export a default Solid component.
-
-Instead, they export functions that are named after the HTTP method that they handle. For example, a `GET` request would be handled by the exported `GET` function.
-
-```tsx twoslash filename="routes/api/students.ts"
-// handles HTTP GET requests to /api/students
-export function GET() {
- return new Response("Hello World");
-}
-
-export function POST() {
- // ...
-}
-
-export function PATCH() {
- // ...
-}
-
-export function DELETE() {
- // ...
-}
-```
-
-## Implementing an API Route handler
-
-An API route gets passed an `APIEvent` object as its first argument. This object contains:
-
-- `request`: `Request` object representing the request sent by the client.
-- `params`: Object that contains the dynamic route parameters, e.g. for `/api/students/:id`, when user requests `/api/students/123` , `params.id` will be `"123"`.
-- `fetch`: An internal `fetch` function that can be used to make requests to other API routes without worrying about the `origin` of the URL.
-
-An API route is expected to return JSON or a [`Response`][response] object. Let's look at an example of an API route that returns a list of students in a given house, in a specific year:
-
-```tsx twoslash filename="routes/api/[house]/students/year-[year].ts"
-// @filename: hogwarts.ts
-export default {
- getStudents(house: string, year: string) {
- return [
- { name: "Harry Potter", house, year },
- { name: "Hermione Granger", house, year },
- { name: "Ron Weasley", house, year }
- ];
- }
-};
-
-// @filename: index.ts
-// ---cut---
-import type { APIEvent } from "@solidjs/start/server";
-import hogwarts from "./hogwarts";
-
-export async function GET({ params }: APIEvent) {
- console.log(`House: ${params.house}, Year: ${params.year}`);
- const students = await hogwarts.getStudents(params.house, params.year);
- return students;
-}
-```
-
-## Session management
-
-As HTTP is a stateless protocol, for awesome dynamic experiences, you want to know the state of the session on the client. For example, you want to know who the user is. The secure way of doing this is to use HTTP-only cookies.
-
-You can store session data in them and they are persisted by the browser that your user is using. We expose the `Request` object which represents the user's request. The cookies can be accessed by parsing the `Cookie` header. We can access helpers from `vinxi/http` to make that a bit easier.
-
-Let's look at an example of how to use the cookie to identify the user:
-
-```tsx filename="routes/api/[house]/admin.ts"
-import type { APIEvent } from "@solidjs/start/server";
-import { getCookie } from "vinxi/http";
-import hogwarts from "./hogwarts";
-
-export async function GET(event: APIEvent) {
- const userId = getCookie("userId");
- if (!userId) {
- return new Response("Not logged in", { status: 401 });
- }
- const houseMaster = await hogwarts.getHouseMaster(event.params.house);
- if (houseMaster.id !== userId) {
- return new Response("Not authorized", { status: 403 });
- }
- return await hogwarts.getStudents(event.params.house, event.params.year);
-}
-```
-
-This is a very simple example and quite unsecure, but you can see how you can use cookies to read and store session data. Read the [session][session] documentation for more information on how to use cookies for more secure session management.
-
-You can read more about using HTTP cookies in the [MDN documentation][cookies].
-
-## Exposing a GraphQL API
-
-SolidStart makes it easy to implement a GraphQL API. The `graphql` function takes a GraphQL schema and returns a function that can be used as an API route handler.
-
-- Install the `graphql` library
-- Then in any route file you can implement a graphql api like below
-
-```ts twoslash filename="routes/graphql.ts"
-import { buildSchema, graphql } from "graphql";
-import type { APIEvent } from "@solidjs/start/server";
-
-// Define GraphQL Schema
-const schema = buildSchema(`
- type Message {
- message: String
- }
-
- type Query {
- hello(input: String): Message
- goodbye: String
- }
-`);
-
-// Define GraphQL Resolvers
-const rootValue = {
- hello: () => {
- return {
- message: "Hello World"
- };
- },
- goodbye: () => {
- return "Goodbye";
- }
-};
-
-// request handler
-const handler = async (event: APIEvent) => {
- // get request body
- const body = await new Response(event.request.body).json();
-
- // pass query and save results
- const result = await graphql({ rootValue, schema, source: body.query });
-
- // send query result
- return result;
-};
-
-export const GET = handler;
-
-export const POST = handler;
-```
-
-## Exposing a tRPC Server route
-
-Let's see how to expose a [tRPC][trpc] server route. First you write your router, put it in a separate file so that you can export the type for your client.
-
-```tsx filename="lib/router.ts"
-import { initTRPC } from "@trpc/server";
-import { wrap } from "@decs/typeschema";
-import { string } from "valibot";
-
-const t = initTRPC.create();
-
-export const appRouter = t.router({
- hello: t.procedure.input(wrap(string())).query(({ input }) => {
- return `hello ${input ?? "world"}`;
- })
-});
-
-export type AppRouter = typeof appRouter;
-```
-
-Here is a simple client that you can use to fetch data from your [tRPC][trpc] server.
-
-```tsx filename="lib/trpc.ts"
-import { createTRPCProxyClient, httpBatchLink, loggerLink } from "@trpc/client";
-import type { AppRouter } from "./router";
-
-export const client = createTRPCProxyClient({
- links: [loggerLink(), httpBatchLink({ url: "http://localhost:3000/api/trpc" })]
-});
-```
-
-Finally, you can use the `fetch` adapter to write an API route that acts as the tRPC server.
-
-```tsx filename="routes/api/trpc/[trpc].ts"
-import { type APIEvent } from "solid-start/api";
-import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
-import { appRouter } from "~/lib/router";
-
-const handler = (event: APIEvent) =>
- fetchRequestHandler({
- endpoint: "/api/trpc",
- req: event.request,
- router: appRouter,
- createContext: () => ({})
- });
-
-export const GET = handler;
-
-export const POST = handler;
-```
-
-Learn more about [tRPC][trpc] here.
-
-[cookies]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
-[session]: /advanced/session
-[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
-[createServerData]: /api/createServerData
-[trpc]: https://trpc.io
-[routing]: /core-concepts/routing
diff --git a/docs/routes/core-concepts/css-and-styling.md b/docs/routes/core-concepts/css-and-styling.md
deleted file mode 100644
index c933817e8..000000000
--- a/docs/routes/core-concepts/css-and-styling.md
+++ /dev/null
@@ -1,88 +0,0 @@
----
-section: core-concepts
-title: CSS and Styling
-order: 4
-active: true
----
-
-# CSS and Styling
-
-Some frameworks modify the behavior of the [`