doseofted / prim-rpc

Easy-to-understand, type-safe, transport-agnostic RPC/IPC for JavaScript, supporting callbacks, batching, file handling, custom serialization, and more.
https://prim.doseofted.me
Apache License 2.0
98 stars 1 forks source link

Documentation for Usage in Remix #74

Closed doseofted closed 8 months ago

doseofted commented 11 months ago

[!NOTE]

This plugin is not needed and could be replaced by the Fetch API (server).

On second thought, the context/params could be useful.

This is a possible plugin for Remix. Update the documentation to reflect Fetch API setup inside of Remix.

Example server (complete docs later) at app/routes/api.$:

import { createPrimServer } from "@doseofted/prim-rpc"
import { primFetch } from "@doseofted/prim-rpc-plugins/server-fetch"
import * as module from "./example-module"
import type { ActionFunction, LoaderFunction } from "@remix-run/node"

const fetch = primFetch({
  prim: createPrimServer({ prefix: "/api", module }),
})

export const loader: LoaderFunction = ({ request }) => fetch(request)
export const action: ActionFunction = ({ request }) => fetch(request)
changeset-bot[bot] commented 11 months ago

🦋 Changeset detected

Latest commit: 67455652254208771959a8dfa27e3323b8dff12c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ------------------------------ | ----- | | @doseofted/prim-rpc-plugins | Patch | | @doseofted/prim-example-server | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

vercel[bot] commented 11 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
prim-rpc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 23, 2024 2:57am