Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dappworks/urpc

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dappworks/urpc

To install dependencies:

  • 0.0.22
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
70
increased by1650%
Maintainers
4
Weekly downloads
 
Created
Source

urpc

To install dependencies:

bun add @dappworks/urpc
import {
  URPC,
  createServerClient,
  createSimpleHttpClient,
} from "@dappworks/urpc";

const urpc = new URPC({
  schemas: {
    sum: URPC.Func({
      input: { a: 0, b: 0 },
      func: ({ input }) => input.a + input.b,
    }),
    foo: URPC.Var({ get: () => data.foo }),
  },
});

// server
const serverClient = createServerClient({ urpc });
const app = new Hono();
app.post("/urpc", async (c) => {
  const body = (await c.req.json()) as any;
  const res = await serverClient.handle(body);
  return c.json(res);
});

// client
const client = createSimpleHttpClient<typeof urpc.schemas>({
  url: "http://localhost:3000/urpc",
});
client.func.call();
client.var.set();
client.schema.loadFull();
client.schema.loadVars();

To run:

bun run index.ts

This project was created using bun init in bun v1.1.3. Bun is a fast all-in-one JavaScript runtime.

FAQs

Package last updated on 12 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc