# rpc-buddy

> RPC Buddy allows me to automatically expose back-end Javascript methods for use by browser frontend code.

Latest version **1.2.6** (published 2023-10-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install rpc-buddy
pnpm add rpc-buddy
yarn add rpc-buddy
bun add rpc-buddy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.6 |
| Published | 2023-10-10 |
| First published | 2021-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dulce Engineering |
| Maintainers | dulce-engineering |
| Keywords | json, rpc, javascript, nodejs, express |

## Links

- npm: https://www.npmjs.com/package/rpc-buddy
- Repository: https://github.com/Dulce-Engineering/rpc-buddy
- Homepage: https://github.com/Dulce-Engineering/rpc-buddy#readme
- Issues: https://github.com/Dulce-Engineering/rpc-buddy/issues
- npm.io page: https://npm.io/package/rpc-buddy

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.2.6 (latest) — 2023-10-10
- 1.2.5 — 2023-02-09
- 1.2.4 — 2022-11-11
- 1.2.3 — 2022-11-09
- 1.2.2 — 2022-08-15
- 1.2.1 — 2021-09-30
- 1.2.0 — 2021-09-30
- 1.1.0 — 2021-09-29
- 1.0.0 — 2021-09-20

## README

# RPC Buddy
RPC Buddy allows me to automatically expose back-end Javascript methods for use by browser frontend code.

## Never again do I have to write a single line of "fetch" code!!
I attach this single class to my Express setup, specify which classes and methods to expose and BAM!
My methods are accessible! 
On the frontend, I just import a dynamically generated client and start making direct identical calls to my methods.

## An Example
Say I have a backend class like so:
```javascript
class someClass
{
  static someFunction(p1, p2, p3)
  {
    return p1 + ", " + p2 + ", " + p3;
  }
}
```

I integrate RPC Buddy with Express and specify which methods to expose like so:
```javascript
const rpcBuddy = require('./RPC_Buddy');
const someClass = require('./someClass');

new rpcBuddy
(
  expressApp, 
  '/serverUrl', '/clientUrl', // backend endpoints
  [someClass], // classes to expose
  [{name: "someClass.someFunction"}] // class methods to expose
);
```

In my browser code I can, straight away, make backend calls like so:
```javascript
import someClass from "/clientUrl?class=someClass";

window.onload = main;
async function main()
{
  const res = await someClass.someFunction("one", "two", "three");
  alert(res); // will show "one, two, three"
}
```

Main docs at homepage.

---
_Source: https://npm.io/package/rpc-buddy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
