This covers the server-side Fetch handler. There’s also a client-specific Fetch plugin available to use.
Prim+RPC supports the Fetch API as used in modern JavaScript runtimes like Bun and Deno. Node can also use the Fetch API
through the @whatwg-node/*
ponyfill and server adapter.
First, you’ll need some module with functions that you’d like to expose to the client:
Now we can configure our Prim+RPC server with our module using the Fetch API:
The Fetch function will be used with the server of your choice. Choose your runtime:
Your server should now be available on the address show above, unless you have changed settings. Take note of the
address as will become the client’s endpoint. The /prim
prefix may also be different if you’ve configured it in
your Prim+RPC server. You can test it out like so:
You may also choose a compatible method plugin:
Report an Issue