raw-node-rpc
v1.0.0
Published
Raw, clean Node.js-to-browser RPC with one-liner setup and auto-generated browser client.
Maintainers
Readme
🦄 Raw Node RPC
Minimal, hacker-style RPC for Node and browser.
Define server functions, call from browser—no boilerplate, one import, works with any Express app.
Get Started
npm install
npm startVisit http://localhost:3000 on phone or desktop.
How it works
- Define your Node functions in
server.js - Attach with
createServer(app, fns) - Call them from browser with the tiny ES module client
- No need to define RPC routes or write fetch glue
Example
// server.js
const express = require('express')
const { createServer } = require('./raw-node-rpc')
const app = express()
app.use(express.static('public'))
const fns = {
sum: (a, b) => a + b,
greet: name => `Hello, ${name}!`
}
createServer(app, fns)
app.listen(3000)// public/client.js
// Link an index.html file to this to test it in your browser
import { makeRPC } from './rpc-client.js'
const api = makeRPC()
api.sum(2, 5).then(console.log) // 7Built by Ismail – raw, clean, for the people.
