mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
readme working?
This commit is contained in:
parent
b997ca4c04
commit
ebda5a6cdc
30
README.md
30
README.md
@ -13,12 +13,12 @@ Then require it in your app.
|
||||
|
||||
Then initialize a gun instance with your AWS S3 credentials.
|
||||
|
||||
```
|
||||
```JavaScript
|
||||
var gun = Gun({
|
||||
s3: {
|
||||
key: '', // AWS Access Key
|
||||
secret: '', // AWS Secret Token
|
||||
bucket: '' // The bucket you want to save into
|
||||
s3: {
|
||||
key: '', // AWS Access Key
|
||||
secret: '', // AWS Secret Token
|
||||
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.
|
||||
|
||||
```
|
||||
```JavaScript
|
||||
var Gun = require('gun');
|
||||
var gun = Gun({
|
||||
s3: {
|
||||
key: '', // AWS Access Key
|
||||
secret: '', // AWS Secret Token
|
||||
bucket: '' // The bucket you want to save into
|
||||
s3: {
|
||||
key: '', // AWS Access Key
|
||||
secret: '', // AWS Secret Token
|
||||
bucket: '' // The bucket you want to save into
|
||||
}});
|
||||
gun.set({ hello: 'world' }).key('my/first/data')
|
||||
|
||||
var http = require('http');
|
||||
http.createServer(function (req, res) {
|
||||
gun.load('my/first/data', function(data){
|
||||
res.writeHead(200, {'Content-Type': 'application/json'});
|
||||
res.end(JSON.stringify(data));
|
||||
});
|
||||
gun.load('my/first/data', function(data){
|
||||
res.writeHead(200, {'Content-Type': 'application/json'});
|
||||
res.end(JSON.stringify(data));
|
||||
});
|
||||
}).listen(1337, '127.0.0.1');
|
||||
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user