diff --git a/Procfile b/Procfile index 0a818360..27c577d6 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: node init.js \ No newline at end of file +web: node examples/admin/app.js \ No newline at end of file diff --git a/examples/admin/app.js b/examples/admin/app.js new file mode 100644 index 00000000..20fb878a --- /dev/null +++ b/examples/admin/app.js @@ -0,0 +1,25 @@ +console.log("If modules not found, run `npm install` in example/admin folder!"); +var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || 8888; +var express = require('express'); +var bodyParser = require('body-parser'); +var app = express(); +var Gun = require('gun'); + +var gun = Gun({ + peers: 'http://localhost:' + port + '/gun' + ,s3: require('../../test/shotgun') // replace this with your own keys! +}); + +app.use(express.static(__dirname)) + .use(bodyParser.json()) + .use(gun.server); + +app.listen(port); +console.log('Express started on port ' + port + ' with /gun'); + +gun.load('blob/data', function(){ // ugly little idempotent initializer, in case no data is set + gun.set({_:{'#': "yVbyf7BqlXVQQUOE5cw9rf8h",'>':{hello: 1407328713707,from: 1407328713707}}, // this is an actual gun object, this won't overwrite any new changes + hello: "world", + from: "Mark Nadal" + }).key('blob/data'); +}); \ No newline at end of file diff --git a/examples/admin/data.json b/examples/admin/data.json deleted file mode 100644 index 6a5cb0ee..00000000 --- a/examples/admin/data.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "_":{ - "#":"yVbyf7BqlXVQQUOE5cw9rf8h", - ">":{ - "hello":1407328713707, - "from":1407328713707 - } - }, - "hello":"world", - "from":"Mark Nadal" -} \ No newline at end of file diff --git a/examples/admin/index.html b/examples/admin/index.html index d3837ea7..4e9948d5 100644 --- a/examples/admin/index.html +++ b/examples/admin/index.html @@ -3,9 +3,6 @@
- @@ -37,9 +34,6 @@