Prim+RPC supports Astro in SSR mode.
Let’s say that you have a module like so (you can place functions wherever you’d like):
You may configure Prim+RPC with Astro’s Server Endpoints by using a catch-all route in your pages directory:
Your Prim+RPC server is now set up! Astro is a fullstack framework that runs on both server and client, which means the Prim+RPC client may be called on the server.
On the server, you can avoid a network request from the client by conditionally passing the module. Below is an example of how you may do so, using the Fetch API method plugin:
Now this exported client may used from anywhere in your project:
You may also choose a compatible method plugin:Report an Issue
No sections available.