https://github.com/asynched/http-rpc
Remote procedure calls with HTTP and Javascript
https://github.com/asynched/http-rpc
http node rpc
Last synced: 13 days ago
JSON representation
Remote procedure calls with HTTP and Javascript
- Host: GitHub
- URL: https://github.com/asynched/http-rpc
- Owner: asynched
- Created: 2022-06-16T03:41:03.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-16T04:50:49.000Z (almost 4 years ago)
- Last Synced: 2025-12-25T22:33:13.545Z (4 months ago)
- Topics: http, node, rpc
- Language: JavaScript
- Homepage:
- Size: 46.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# http-rpc
This is a test on doing remote procedure calls over HTTP with React.
My main goal with this is to explore remote procedure calls, using them as a function for the front-end. As you'll see in the project, the front-end uses a proxy object to do the remote calls for the back-end, providing a simple interface for executing remote calls.
```js
// The main goal is to build something that looks something
// like the code below, bridging the gap between front-end
// and back-end.
const output = await rpcConnector.readFile({ filename: 'package.json' })
console.log(output.contents)
```
As for the back-end, registering procedures to be called by the rpc connector should be just as easy as the front-end. Ended up with an API that looks like this:
```js
// As for the back-end, you register a procedure attributing a
// callback function to the procedure name. Because of proxies
// we can afford to do this magic.
procedures.readFile = ({ filename }) => {
// Do something with the args
return null
}
```