Open History to see the last commit
1import { createFileRoute } from '@tanstack/solid-router'
2import { createMiddleware, json } from '@tanstack/solid-start'
3β
4const testParentMiddleware = createMiddleware().server(async ({ next }) => {
5 const result = await next({ context: { testParent: true } })
6 return result
7})
8β
9const testMiddleware = createMiddleware()
10 .middleware([testParentMiddleware])
11 .server(async ({ next }) => {
12 const result = await next({ context: { test: true } })
13 return result
14 })
15β
16export const Route = createFileRoute('/api/middleware-context')({
17 server: {
18 middleware: [testMiddleware],
19 handlers: {
20 GET: ({ request, context }) => {
21 return json({
22 url: request.url,
23 context: context,
24 expectedContext: { testParent: true, test: true },
25 })
26 },
27 },
28 },
29})