Created
May 30, 2022 14:35
-
-
Save draeder/1af1da351299a25c9f63bb4fae90c1db to your computer and use it in GitHub Desktop.
Gun server example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http') | |
const Gun = require('gun') | |
// Uncomment for ES6, and remove requires above | |
// import http from 'http' | |
// import Gun from 'gun' | |
const server = http.createServer() | |
const host = 'localhost' | |
const port = 8080 | |
var gun = Gun({ | |
web: server, | |
peers: ['https://relay.peer.ooo/gun'] | |
}) | |
server.listen(8080, () => { | |
console.log( | |
'Server started on port ' + port + ' with /gun', | |
) | |
gun.get('test').on(data => console.log(data)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment