The Docs.

Prim+RPC is in prerelease mode and may be unstable until official release.

Examples

Sometimes the easiest way to learn a new library is to not by guide but by example. Several example projects have been created to demonstrate how Prim+RPC can be used in different environments and integrated with popular frameworks.

See the README.md file in each linked example for an overview of that project.

Simple Test

Open in StackBlitz

This example demonstrates the simplest usage of Prim+RPC: in a single file as it may be used in a testing environment.

You can download this example with the command below or download Simple Test directly.

npx giget@latest gh:doseofted/prim-rpc-examples/simple-test prim-rpc-examples/simple-test

Server/Client Interaction

Open in StackBlitz

This example demonstrates communication between a web server and website in the same project with Prim+RPC.

You can download this example with the command below or download Server/Client Interaction directly.

npx giget@latest gh:doseofted/prim-rpc-examples/client-server prim-rpc-examples/client-server

Serverless

Open in StackBlitz

This example demonstrates communication between a serverless function and website in the same project with Prim+RPC.

You can download this example with the command below or download Serverless directly.

npx giget@latest gh:doseofted/prim-rpc-examples/serverless prim-rpc-examples/serverless

Web Worker Communication

Open in StackBlitz

This example demonstrates communication between a website and its Web Worker.

You can download this example with the command below or download Web Worker Communication directly.

npx giget@latest gh:doseofted/prim-rpc-examples/web-worker prim-rpc-examples/web-worker

Monorepo Setup

Open in StackBlitz

This example demonstrates a monolithic repository where a separate JavaScript module is imported by a web server using Prim+RPC.

You can download this example with the command below or download Monorepo Setup directly.

npx giget@latest gh:doseofted/prim-rpc-examples/monorepo-setup prim-rpc-examples/monorepo-setup

Custom JSON Handler

Open in StackBlitz

This example demonstrates a Prim+RPC project where the JSON handler is replaced with an alternative handler.

You can download this example with the command below or download Custom JSON Handler directly.

npx giget@latest gh:doseofted/prim-rpc-examples/custom-handler prim-rpc-examples/custom-handler

Server Context

Open in StackBlitz

This example demonstrates a web server that shares its request context with Prim+RPC.

You can download this example with the command below or download Server Context directly.

npx giget@latest gh:doseofted/prim-rpc-examples/server-context prim-rpc-examples/server-context

Fullstack Framework

Open in StackBlitz

This example demonstrates Prim+RPC when used in a fullstack framework.

You can download this example with the command below or download Fullstack Framework directly.

npx giget@latest gh:doseofted/prim-rpc-examples/fullstack-framework prim-rpc-examples/fullstack-framework
Report an Issue