mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00

TODO: 1) if the peer change the id, will lost the subscribes. Workaround for this is set the pid (unique) in: Gun(pid: 'mypeerid', peers:[...]) 2) If the superpeer die, the subscribes will be lost. Each peer must resubscribe all souls.
18 lines
663 B
JavaScript
18 lines
663 B
JavaScript
console.log("If module not found, install express globally `npm i express -g`!");
|
|
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765;
|
|
var express = require('express');
|
|
var Gun = require('..');
|
|
require('../axe');
|
|
|
|
var app = express();
|
|
app.use(Gun.serve);
|
|
app.use(express.static(__dirname));
|
|
|
|
var server = app.listen(port);
|
|
var gun = Gun({ file: 'data', web: server });
|
|
|
|
global.Gun = Gun; /// make global to `node --inspect` - debug only
|
|
global.gun = gun; /// make global to `node --inspect` - debug only
|
|
|
|
console.log('Server started on port ' + port + ' with /gun');
|