Calling database with server actions in Solid Start
Hey all, I have a question more about best practices than anything. In the Solid Start docs, under the Server Actions heading, it says the following:
My question is why this may be considered a bad idea, especially when it's not frowned upon in createServerData$.
5 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
That being said, many people love having an isomorphic app with frontend and backend in the same codebase
solid start as a framework is built to support this
I guess I’m aware of the philosophy, I’m more confused on why it would mention it specifically for the actions, but then on the API page it seems to take a stance that it DB calls should be used in the same file:
“While we think that using createServerData$ is the best way to write server-side code for data needed by your UI, sometimes you need to expose API routes.”
I appreciate the responses! I think I was just worried there was something specifically with the actions that was considered a bad practice, but I am pretty sure I am in the camp that likes the idea of consolidated code in one spot. Will definitely try it out and see how I like it!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Awesome! I understand the docs (and solid start) are very much in-development so I’m happy even having this much to go off of, I think I was just overthinking the wording.