Can the server$ call get access to the Request object?
I'm confused on why
has a request object but server$ does not.
I'm trying to grab the current user when I do a server$ call, but I don't have any way to know what user it is because userServerContext() is {} and I don't see any way to get that data. I'm piling through the SolidStart source code right now but I don't see anything.
I love Solid and Solid start but a few more examples in the documentation would really help.
7 Replies
Meow?
You should be able to access the request with
server$.request
createServerData$ also delivers the request object
Wow that is a lifesaver!!! That worked perfectly! How on earth did you figure that out? I don't see any references to that in the documentation or anywhere on the internet actually
It seems like createServerData$ is only meant to work on route nav, unless I'm missing someting. IN my case I don't want to nav. Edivado's solution works though thankfully.
No, it can be used anywhere
createServerData$ is just a combination of createResource and server$
Weird okay. I don't see anything on the docs using it that way. I'll see if I can scrape up some examples on github or something. Thanks for the info.
Should one in most cases stay away from server$? createServerData$ is according to the docs a wrapper around createRouteData + server$