fix express

This commit is contained in:
Mark Nadal 2017-03-13 19:46:12 -07:00
parent 029e11e907
commit 2d455d30b5
5 changed files with 15 additions and 10 deletions

View File

@ -2,11 +2,14 @@ console.log("If modules not found, run `npm install` in /example folder!"); // g
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8080;
var express = require('express');
var http = require('http');
var app = express();
var server = http.createServer(app);
var Gun = require('../');
var gun = Gun({
file: 'data.json',
web: server,
s3: {
key: '', // AWS Access Key
secret: '', // AWS Secret Token
@ -14,7 +17,8 @@ var gun = Gun({
}
});
gun.wsp(app);
app.use(express.static(__dirname)).listen(port);
app.use(Gun.serve);
app.use(express.static(__dirname));
server.listen(port);
console.log('Server started on port ' + port + ' with /gun');

2
gun.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -6,16 +6,13 @@ var url = require('url');
console.log("Experimental high performance uWS server is being used.");
Gun.on('opt', function(at){
Gun.on('opt', function mount(at){
this.to.next(at);
if(at.once){ return }
var opt = at.opt.uws || at.opt.ws || (at.opt.uws = {});
var cat = (at.gun.back(-1)._);
opt.server = opt.server || at.opt.web;
if(opt.server && opt.server.use){ // if ExpressJS
opt.server.use(Gun.serve);
}
opt.web = new WebSocket.Server(opt);
var peers = cat.opt.peers;

View File

@ -1,6 +1,6 @@
{
"name": "gun",
"version": "0.6.5",
"version": "0.6.6",
"description": "Graph engine",
"main": "index.js",
"browser": "gun.min.js",

View File

@ -4,8 +4,11 @@ Gun.chain.set = function(item, cb, opt){
var gun = this, soul;
cb = cb || function(){};
if(soul = Gun.node.soul(item)){ return gun.set(gun.back(-1).get(soul), cb, opt) }
if(Gun.obj.is(item) && !Gun.is(item)){ return gun.set(gun._.root.put(item), cb, opt) }
return item.get('_').get(function(at, ev){
if(!Gun.is(item)){
if(Gun.obj.is(item)){ return gun.set(gun._.root.put(item), cb, opt) }
return gun.get(Gun.text.random()).put(item);
}
item.get('_').get(function(at, ev){
if(!at.gun || !at.gun._.back);
ev.off();
at = (at.gun._.back._);
@ -13,5 +16,6 @@ Gun.chain.set = function(item, cb, opt){
if(!soul){ return cb.call(gun, {err: Gun.log('Only a node can be linked! Not "' + node + '"!')}) }
gun.put(Gun.obj.put(put, soul, Gun.val.rel.ify(soul)), cb, opt);
},{wait:0});
return item;
}