mirror of
https://github.com/amark/gun.git
synced 2025-06-06 14:16:44 +00:00
Merge branch 'master' of https://github.com/amark/gun
This commit is contained in:
commit
f90f6f87fe
19
README.md
19
README.md
@ -3,7 +3,7 @@ gun [](https:/
|
|||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
If you do not have [node](http://nodejs.org/) or [npm](https://www.npmjs.com/), read [this](https://github.com/amark/gun/blob/master/examples/start.sh) first.
|
If you do not have [node](http://nodejs.org/) or [npm](https://www.npmjs.com/), read [this](https://github.com/amark/gun/blob/master/examples/install.sh) first.
|
||||||
Then in your terminal, run:
|
Then in your terminal, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -16,11 +16,12 @@ Now you can require it in the app you want to build.
|
|||||||
var Gun = require('gun');
|
var Gun = require('gun');
|
||||||
```
|
```
|
||||||
|
|
||||||
Once included, initialize a gun instance with your AWS S3 credentials.
|
Once included, initialize a gun instance with a file path or your AWS S3 credentials.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var gun = Gun({
|
var gun = Gun({
|
||||||
s3: {
|
file: 'data.json',
|
||||||
|
s3: { // Optional!
|
||||||
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
|
||||||
@ -28,7 +29,9 @@ var gun = Gun({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
S3 is the default persistence layer, it can be replaced with others.
|
These are the default persistence layers, they are modular and can be replaced others.
|
||||||
|
|
||||||
|
Using S3 is recommended for deployment, and using a file is recommended for local development.
|
||||||
|
|
||||||
Now you can save your first object, and create a reference to it.
|
Now you can save your first object, and create a reference to it.
|
||||||
|
|
||||||
@ -40,13 +43,7 @@ Altogether, try it with the node hello world web server which will reply with yo
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var Gun = require('gun');
|
var Gun = require('gun');
|
||||||
var gun = Gun({
|
var gun = Gun({ file: 'data.json' });
|
||||||
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');
|
gun.set({ hello: 'world' }).key('my/first/data');
|
||||||
|
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user