solid-start
solid-start copied to clipboard
api route example in docs doesn't seem to work
Describe the bug
I've been frustratingly trying to understand why I can't seem to get this example from the docs to work.
https://docs.solidjs.com/solid-start/building-your-application/api-routes
routes/api/product/[category]/brand-[brand].ts
import type { APIEvent } from "@solidjs/start/server";
import store from "./store";
export async function GET({ params }: APIEvent) {
console.log(`Category: ${params.category}, Brand: ${params.brand}`);
const products = await store.getProducts(params.category, params.brand);
return products;
}
Your Example Website or App
https://stackblitz.com/edit/github-grada5-j81cuh?file=src%2Froutes%2Fapi%2Fproduct%2F%5Bcategory%5D%2Fbrand-%5Bbrand%5D.ts
Steps to Reproduce the Bug or Issue
From my understanding loading the following api route should work but I just get 404.
/api/product/tools/brand-dewalt
Expected behavior
I expected the api route to return
{
"category": "tools",
"brand": "dewalt"
}
but I just get 404 on the route.
do I have a misunderstanding of how that route should work?
Screenshots or Videos
No response
Platform
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context
No response