Cone
Run server code only once
I'm trying to run an embedded db in SolidStart, but every time a new route is visited the db initialization is re-run and the db data gets corrupted. Is there a way to only run the db code once and reuse it for all routes? I saw this issue in nitro which seems like it would solve it, but the code still runs for every route https://github.com/nitrojs/nitro/issues/711#issuecomment-1415819402
My db initialization in
utils/db.ts
looks like:
3 replies
Throwing a redirect inside a query
When throwing a redirect from a query, the throw gets caught and returns undefined instead. The inferred return type is wrong in this case, but when throwing other values the throw is not caught. Is the query function typing wrong, or am I using query wrong?
3 replies