Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

openFPGA666/P2PNodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

6 Commits

Repository files navigation

P2PNodejs

P2PNodejs--this is a smiple example which is based on nodejs to realize the P2P network

Quick start

npm install
HTTP_PORT=3001 P2P_PORT=6001 npm start
HTTP_PORT=3002 P2P_PORT=6002 npm start
curl -H "Content-type:application/json" --data '{"peer" : "ws://localhost:6001"}' http://localhost:3001/addPeer
#win
set HTTP_PORT=3001 set P2P_PORT=6001 npm start
set HTTP_PORT=3002 set P2P_PORT=6002 npm start
curl -H "Content-type:application/json" --data "{\"peer\" : \"ws://localhost:6001\"}" http://localhost:3001/addPeer
#view Peers
curl http://localhost:3001/addPeer 
#operations
curl -H "Content-type:application/json" --data "" http://localhost:3001/numAdd
curl http://localhost:3001/getNum

About

P2PNodejs--this is a smiple example which is based on nodejs to realize the P2P network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /