3 ms·
If you wanna take the concept up a notch: https://rakkasjs.org/guide/use-server-side-query https://rakkasjs.org/guide/use-server-side-query
by cyco130 3y ago
If you wanna take the concept up a notch: https://rakkasjs.org/guide/use-server-side-query https://rakkasjs.org/guide/use-server-side-query
- nerdponx 3y ago> When it runs on the client, variables from the surrounding scope that you use in the server-side function are captured, serialized, and sent to the server. Since anyone can send any request to the server, you have to validate everything that comes from the surrounding scope. This is mildly horrifying to consider without good tooling support.
- cyco130 3y agoOn the next iteration, we're planning on providing a `createServerQuery` function which will _not_ capture the closure and return a function that can take an arbitrary number of arguments to be serialized. `createServerQuery` will have a required `validator` option that will also run on the server to validate those arguments.