all_is_source_energy
API w/o File Routes Component Possible?!
I tried [...404].ts w/ a
export function POST(event: APIEvent) {}
in it but the log did not work, i also tried /api/[api].ts
but that did not work either, how would you create a catch all, all for anything under /api please?6 replies
onCleanup is running on server
ty Sir! very interesting gr8 to know thanks! this worked too btw!
import { onCleanup } from 'solid-js'
import { clientOnly } from '@solidjs/start'
export default clientOnly(() => Promise.resolve({ default: () => {
onCleanup(() => {
alert('hi')
})
return <></>
}}))
3 replies
Current User Items Cache
Really appreciate how thorough your responses are! Teaching me a lot thank you! Especially super valuable knowing how the references work w/ query thank you!
My backend could be used for other devices in the future (mobile applications) and I am working w/ a guy that loves testing routes w/ postman so I would love to stay boring w/ api routes so just a fetch w/in query() is perfect for me, I created a script to generate types & a function so i can get typesafety to the api though!
10 replies
Current User Items Cache
thanks @peerreynders ! I love your wisdom! So my goal is to:
const contracts = query(() => {
"use server";
// call /api route
// return current users contracts
}, "contracts");
So each user in each browser will have their own cache for their personal contracts, which is perfect!
Oor I misunderstood & it does not work that way! lol
10 replies
Different routes using different layouts, while doing file based routing please?
Thanks I see my confusion, idk yet how to do layouts correctly with parens. My goal is (auth) folder w/ child files like [ ./routes/(auth)/sign-in.tsx ] and a layout file for the (auth) child files
I tried ./routes/(auth).tsx and ./routes/auth.tsx for the layout file and neither worked yet thanks!
& I just did something simple for the layout like:
import { type JSX } from 'solid-js'
export function Layout (
{ children, ...props }:
{children: JSX.Element } & JSX.IntrinsicElements['div']) {
return <>
<div id="abc" {...props}>
{children}
</div>
</>
}
13 replies
Different routes using different layouts, while doing file based routing please?
Thanks! So ./b should be a route in the following example please?
./routes/a.tsx - route showed up @ ./a
./routes/b.tsx - route showed up @ ./b
./routes/(c)/b.tsx - error @ ./b
TypeError: response.headers is not iterable
at sendWebResponse (file:/node_modules/h3/dist/index.mjs:929:39)
at eval (/Users/chriscarrington/gotcontract/node_modules/vinxi/runtime/http.js:144:12)
at eval (/Users/chriscarrington/gotcontract/node_modules/@solidjs/start/dist/middleware/index.jsx:10:54)
at async _callHandler (file:/node_modules/h3/dist/index.mjs:1831:7)
at async _callHandler (file:/node_modules/h3/dist/index.mjs:1837:16)
at async file:/node_modules/h3/dist/index.mjs:1978:19
at async Object.callAsync (file:/node_modules/unctx/dist/index.mjs:72:16)
at async Server.toNodeHandle (file:/node_modules/h3/dist/index.mjs:2270:7)
13 replies
Different routes using different layouts, while doing file based routing please?
src/routes/(one).tsx --- Layout for (one) routes
src/routes/(one)/a.tsx. --- UI for ./a (which uses the one layout)
src/routes/(two).tsx. --- Layout for (two) routes
src/routes/(two)/b.tsx --- UI for ./b (which uses the two layout)
src/routes/(two)/c.tsx --- UI for ./c (which uses the two layout)
Is this the expected behavior please? if yes I'll make a small example b/c in my more complex current example I'm not seeing this behavior but I wanna ensure I'm interpreting this correctly first please, thanks!
13 replies
Using solid-mdx in an SPA app (without solid-start/vinxi)
Use a package that works in the browser? https://github.com/markedjs/marked
3 replies