readme working?

This commit is contained in:
amark 2014-09-10 22:15:29 -07:00
parent b997ca4c04
commit ebda5a6cdc

View File

@ -13,12 +13,12 @@ Then require it in your app.
Then initialize a gun instance with your AWS S3 credentials. Then initialize a gun instance with your AWS S3 credentials.
``` ```JavaScript
var gun = Gun({ var gun = Gun({
s3: { s3: {
key: '', // AWS Access Key key: '', // AWS Access Key
secret: '', // AWS Secret Token secret: '', // AWS Secret Token
bucket: '' // The bucket you want to save into bucket: '' // The bucket you want to save into
}}); }});
``` ```
@ -32,22 +32,24 @@ Save your first object, and create a reference to it.
Now, altogether, with the node hello world web server that replies with your data. Now, altogether, with the node hello world web server that replies with your data.
``` ```JavaScript
var Gun = require('gun'); var Gun = require('gun');
var gun = Gun({ var gun = Gun({
s3: { s3: {
key: '', // AWS Access Key key: '', // AWS Access Key
secret: '', // AWS Secret Token secret: '', // AWS Secret Token
bucket: '' // The bucket you want to save into bucket: '' // The bucket you want to save into
}}); }});
gun.set({ hello: 'world' }).key('my/first/data') gun.set({ hello: 'world' }).key('my/first/data')
var http = require('http'); var http = require('http');
http.createServer(function (req, res) { http.createServer(function (req, res) {
gun.load('my/first/data', function(data){ gun.load('my/first/data', function(data){
res.writeHead(200, {'Content-Type': 'application/json'}); res.writeHead(200, {'Content-Type': 'application/json'});
res.end(JSON.stringify(data)); res.end(JSON.stringify(data));
}); });
}).listen(1337, '127.0.0.1'); }).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/'); console.log('Server running at http://127.0.0.1:1337/');
``` ```
Now fire up your browser and hit that URL - you'll see your data, plus some gun specific metadata.