Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions solid-v2/basic/file-routes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,31 @@ declare module "virtual:file-routes" {
{
path: "/*404";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/[...404]")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/[...404]")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/[...404]"), Extract<"default", keyof typeof import("./src/routes/[...404]")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/[...404]"), Extract<"route", keyof typeof import("./src/routes/[...404]")>>>;
},
{
path: "/";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/index")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/index"), Extract<"default", keyof typeof import("./src/routes/index")>>>;
$$route?: undefined;
},
{
path: "/users";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users"), Extract<"default", keyof typeof import("./src/routes/users")>>>;
$$route?: undefined;
},
{
path: "/users/:id";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users/[id]")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/users/[id]")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users/[id]"), Extract<"default", keyof typeof import("./src/routes/users/[id]")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/users/[id]"), Extract<"route", keyof typeof import("./src/routes/users/[id]")>>>;
},
{
path: "/users/";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users/index")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users/index"), Extract<"default", keyof typeof import("./src/routes/users/index")>>>;
$$route?: undefined;
}
];
Expand All @@ -73,39 +73,39 @@ declare module "virtual:file-routes" {
path: "/";
id: "/";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/index")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/index"), Extract<"default", keyof typeof import("./src/routes/index")>>>;
$$route?: undefined;
children?: undefined;
},
{
path: "/*404";
id: "/*404";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/[...404]")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/[...404]")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/[...404]"), Extract<"default", keyof typeof import("./src/routes/[...404]")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/[...404]"), Extract<"route", keyof typeof import("./src/routes/[...404]")>>>;
children?: undefined;
},
{
path: "/users";
id: "/users";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users"), Extract<"default", keyof typeof import("./src/routes/users")>>>;
$$route?: undefined;
children: readonly [
{
path: "/";
id: "/";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users/index")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users/index"), Extract<"default", keyof typeof import("./src/routes/users/index")>>>;
$$route?: undefined;
children?: undefined;
},
{
path: "/:id";
id: "/:id";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users/[id]")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/users/[id]")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users/[id]"), Extract<"default", keyof typeof import("./src/routes/users/[id]")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/users/[id]"), Extract<"route", keyof typeof import("./src/routes/users/[id]")>>>;
children?: undefined;
}
];
Expand Down
2 changes: 1 addition & 1 deletion solid-v2/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@solidjs/vite-plugin": "^3.0.0-next.54",
"@testing-library/jest-dom": "^7.0.0",
"eslint-plugin-solid": "~0.18.1",
"filesystem-routing": "0.4.0",
"filesystem-routing": "0.4.2",
"jsdom": "^25.0.1",
"oxlint": "~1.79.0",
"typescript": "^5.9.2",
Expand Down
16 changes: 8 additions & 8 deletions solid-v2/basic/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion solid-v2/fullstack-tanstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@testing-library/jest-dom": "^7.0.0",
"@types/node": "^26.2.0",
"eslint-plugin-solid": "~0.18.1",
"filesystem-routing": "0.4.0",
"filesystem-routing": "0.4.2",
"jsdom": "^25.0.1",
"oxlint": "~1.79.0",
"typescript": "^5.9.2",
Expand Down
10 changes: 5 additions & 5 deletions solid-v2/fullstack-tanstack/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions solid-v2/fullstack-tanstack/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ import routes from 'virtual:file-routes';

// createAPIHandler serves the GET/POST/... exports of the modules under
// src/api (mounted at /api — see the fileRoutes config in vite.config.ts)
// and passes everything else down the chain. It still speaks the previous
// (request, next) shape and calls next() with no arguments, so adapt it
// onto the event.
const api = createAPIHandler(routes);

const handleAPI: StartMiddleware = (event, next) => api(event.request, next);

export default [handleAPI];
// and passes everything else down the chain. It takes the request event
// directly and hands that same event to the handler (params written onto it).
export default [createAPIHandler(routes)] satisfies StartMiddleware[];
2 changes: 1 addition & 1 deletion solid-v2/fullstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The plugin folds `.env` files into `process.env` for dev, build, and preview —

`src/middleware.ts` (wired via `start.middleware` in `vite.config.ts`) exports a chain of event-first functions, `(event, next) => Response`, fronting every request — page renders, server function calls, and API routes alike. The request is `event.request`. `next()` takes no arguments; assign `event.request` before calling it to hand a different request downstream, and set `event.nonce` or `event.renderMode` on the event before `next()` when a request needs them (the page render runs inside it). The chain runs inside the request-event scope, so `getRequestEvent()` and the session helpers work there exactly as in application code.

A route module may export uppercase `GET`/`POST`/... handlers — an API route. A module with handlers but no default export is a route without a page (`src/routes/api/users.ts`). Handlers are dispatched by the `createAPIHandler` middleware; `fileRoutes({ httpMethods: true })` scans for them with one router serving both sides — handler modules, and the server-only code they import, never enter the client bundle. `createAPIHandler` still takes `(request, next)`, so the template adapts it onto the event-first chain.
A route module may export uppercase `GET`/`POST`/... handlers — an API route. A module with handlers but no default export is a route without a page (`src/routes/api/users.ts`). Handlers are dispatched by the `createAPIHandler` middleware; `fileRoutes({ httpMethods: true })` scans for them with one router serving both sides — handler modules, and the server-only code they import, never enter the client bundle. `createAPIHandler` fits the event-first chain as is: it receives the request event and hands that same event to the handler.

## File-system routing

Expand Down
40 changes: 20 additions & 20 deletions solid-v2/fullstack/file-routes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,38 @@ declare module "virtual:file-routes" {
{
path: "/*404";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/[...404]")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/[...404]")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/[...404]"), Extract<"default", keyof typeof import("./src/routes/[...404]")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/[...404]"), Extract<"route", keyof typeof import("./src/routes/[...404]")>>>;
},
{
path: "/api/users";
page: false;
$GET: FileRouteLazyRef<typeof import("./src/routes/api/users")>;
$HEAD: FileRouteLazyRef<typeof import("./src/routes/api/users")>;
$GET: FileRouteLazyRef<Pick<typeof import("./src/routes/api/users"), Extract<"GET", keyof typeof import("./src/routes/api/users")>>>;
$HEAD: FileRouteLazyRef<Pick<typeof import("./src/routes/api/users"), Extract<"GET", keyof typeof import("./src/routes/api/users")>>>;
$$route?: undefined;
},
{
path: "/";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/index")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/index")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/index"), Extract<"default", keyof typeof import("./src/routes/index")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/index"), Extract<"route", keyof typeof import("./src/routes/index")>>>;
},
{
path: "/users";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/users")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users"), Extract<"default", keyof typeof import("./src/routes/users")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/users"), Extract<"route", keyof typeof import("./src/routes/users")>>>;
},
{
path: "/users/:id";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users/[id]")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/users/[id]")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users/[id]"), Extract<"default", keyof typeof import("./src/routes/users/[id]")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/users/[id]"), Extract<"route", keyof typeof import("./src/routes/users/[id]")>>>;
},
{
path: "/users/";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users/index")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users/index"), Extract<"default", keyof typeof import("./src/routes/users/index")>>>;
$$route?: undefined;
}
];
Expand All @@ -80,39 +80,39 @@ declare module "virtual:file-routes" {
path: "/";
id: "/";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/index")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/index")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/index"), Extract<"default", keyof typeof import("./src/routes/index")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/index"), Extract<"route", keyof typeof import("./src/routes/index")>>>;
children?: undefined;
},
{
path: "/*404";
id: "/*404";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/[...404]")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/[...404]")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/[...404]"), Extract<"default", keyof typeof import("./src/routes/[...404]")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/[...404]"), Extract<"route", keyof typeof import("./src/routes/[...404]")>>>;
children?: undefined;
},
{
path: "/users";
id: "/users";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/users")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users"), Extract<"default", keyof typeof import("./src/routes/users")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/users"), Extract<"route", keyof typeof import("./src/routes/users")>>>;
children: readonly [
{
path: "/";
id: "/";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users/index")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users/index"), Extract<"default", keyof typeof import("./src/routes/users/index")>>>;
$$route?: undefined;
children?: undefined;
},
{
path: "/:id";
id: "/:id";
page: true;
$component: FileRouteLazyRef<typeof import("./src/routes/users/[id]")>;
$$route: FileRouteEagerRef<typeof import("./src/routes/users/[id]")>;
$component: FileRouteLazyRef<Pick<typeof import("./src/routes/users/[id]"), Extract<"default", keyof typeof import("./src/routes/users/[id]")>>>;
$$route: FileRouteEagerRef<Pick<typeof import("./src/routes/users/[id]"), Extract<"route", keyof typeof import("./src/routes/users/[id]")>>>;
children?: undefined;
}
];
Expand Down
2 changes: 1 addition & 1 deletion solid-v2/fullstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@testing-library/jest-dom": "^7.0.0",
"@types/node": "^26.2.0",
"eslint-plugin-solid": "~0.18.1",
"filesystem-routing": "0.4.0",
"filesystem-routing": "0.4.2",
"jsdom": "^25.0.1",
"oxlint": "~1.79.0",
"typescript": "^5.9.2",
Expand Down
16 changes: 8 additions & 8 deletions solid-v2/fullstack/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions solid-v2/fullstack/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ import { createAPIHandler } from 'filesystem-routing/api';
import routes from 'virtual:file-routes';

// createAPIHandler serves the GET/POST/... exports of route modules
// (see src/routes/api) and passes everything else down the chain. It still
// speaks the previous (request, next) shape and calls next() with no
// arguments, so adapt it onto the event.
const api = createAPIHandler(routes);

const handleAPI: StartMiddleware = (event, next) => api(event.request, next);

export default [handleAPI];
// (see src/routes/api) and passes everything else down the chain. It takes
// the request event directly and hands that same event to the handler, with
// the matched params written onto it.
export default [createAPIHandler(routes)] satisfies StartMiddleware[];
Loading