raviqqe/onerpc
Tentang
The router-less serverless RPC framework for TypeScript
Pengembangan web dan aplikasiYang dapat Anda lakukan
- ๐ฎ Seamless client-server communication You can call remote procedures just as seamless as calling local functions.
- ๐ก๏ธ Type safe Server-client communication is made safe with request and response types in TypeScript which are used by both client and server.
- ๐ฅ Serverless first Routing is delegated to other frameworks or infrastructures.
- ๐ค HTTP friendly You can leverage full potential of HTTP functionalities, such as cache control headers.
Pertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- 0
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AslioneRPC
The router-less serverless RPC framework.
oneRPC is a minimal RPC library to convert a server-side function of a type, (input: T) => Promise<S> into (request: Request) => Promise<Response> and make it callable from the client side in a type-safe way.
Currently, we support React Router, Next.js Route Handlers, and AWS Lambda.
Features
๐ฎ Seamless client-server communication
You can call remote procedures just as seamless as calling local functions.
๐ก๏ธ Type safe
Server-client communication is made safe with request and response types in TypeScript which are used by both client and server.
๐ฅ Serverless first
Routing is delegated to other frameworks or infrastructures.
๐ค HTTP friendly
You can leverage full potential of HTTP functionalities, such as cache control headers.
๐ Minimal dependencies
It depends only on Web APIs. Thus, it works on many platforms including Node.js, Deno, and edge runtimes.
๐ Streaming support
Stream responses are transferred as JSON Lines and clients can consume them chunk by chunk.
Documentation
Here.
Examples
For all examples, see a examples directory.
Next.js with Route Handlers
app/api/foo/route.ts:
import { query } from "onerpc";
import { z } from "zod";
export const GET = query(z.number(), z.string(), (x) => `Hello, ${x}!`, {
path: "/api/foo",
});
app/page.tsx:
import { type GET } from "@/app/api/foo/route";
import { query } from "onerpc/client";
export default async (): Promise<JSX.Element> => (
<div>{await query<typeof GET>("/api/foo", 42))}</div>
);
References
License
Jelajahi proyek terkait
Memuatโฆ