Go to file
Ladd Hoffman f8b501859b README formatting 2024-12-22 17:33:22 -06:00
__tests__ keeping track of peers from whom deltas are received 2024-12-22 14:00:51 -06:00
src README 2024-12-22 17:30:41 -06:00
.gitignore peers are able to sync 2024-12-22 09:13:44 -06:00
.nvmrc pretty neat 2024-12-21 21:16:18 -06:00
LICENSE Initial commit 2024-12-19 23:16:45 -06:00
README.md README formatting 2024-12-22 17:33:22 -06:00
eslint.config.js keeping track of peers from whom deltas are received 2024-12-22 14:00:51 -06:00
package-lock.json deduplicate deltas 2024-12-22 14:38:01 -06:00
package.json deduplicate deltas 2024-12-22 14:38:01 -06:00
tsconfig.json pretty neat 2024-12-21 21:16:18 -06:00

README.md

Setup

  • Install nodejs
  • Install nvm

Install

nvm install
npm install

Build

npx tsc
# npm run build # also works

# npx tsc --watch # is useful during development

Run

To demonstrate the example application, you can open multiple terminals. In each terminal execute something like the following.

export RHIZOME_REQUEST_BIND_PORT=4000
export RHIZOME_PUBLISH_BIND_PORT=4001
export RHIZOME_SEED_PEERS='127.0.0.1:4002, 127.0.0.1:4004'
export RHIZOME_HTTP_API_PORT=3000
export RHIZOME_PEER_ID=peer1
node dist/example-app.js
export RHIZOME_REQUEST_BIND_PORT=4002
export RHIZOME_PUBLISH_BIND_PORT=4003
export RHIZOME_SEED_PEERS='127.0.0.1:4000, 127.0.0.1:4004'
export RHIZOME_PEER_ID=peer2
node dist/example-app.js
export RHIZOME_REQUEST_BIND_PORT=4004
export RHIZOME_PUBLISH_BIND_PORT=4005
export RHIZOME_SEED_PEERS='127.0.0.1:4000, 127.0.0.1:4002'
export RHIZOME_PEER_ID=peer3
node dist/example-app.js

In a separate terminal, you can use curl to interact with an instance.

jq is helpful for formatting the json responses.

curl -s  http://localhost:3000/peers/count | jq
curl -s  http://localhost:3000/peers | jq
curl -s  http://localhost:3000/deltas/count | jq
curl -s  http://localhost:3000/deltas | jq