ggeter / GubDBTest

Home Page:https://gundbstarter.ggeter.now.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gun starter app for Greg Geter

Gun application boilerplate

This boilerplate is a good starting point for gun applications, or just for understanding how all the pieces fit together.

Important: Make sure you update the gun version to latest, as the package.json on this app becomes stale!

Cloning

# Download the code
$ git clone https://github.com/gundb/gun-starter-app.git

# Install the dependencies
$ cd gun-starter-app
$ npm install

Once the code has been downloaded, you can easily start the server:

$ npm start

Under the hood, this is just running node server.js

Trying it

In two browser windows, open localhost:8080/index.html.

Make sure your server is running!

There's a global gun reference you can access in the developer console called data. Change the value on message and it'll update in real-time on the other browser.

// Updates on the other browser window.
data.put({
	message: 'updated value',
})

Applying it

The code provided here is just the bare basics. It's intentionally framework agnostic to keep the example simple and reusable.

Now that you've got real-time data sync and a way to listen for changes, you can plug those change events into a UI tool/framework (like jQuery, React, Angular, etc.)

For reference, here are gun apps written with...

Questions

Have more questions? Send 'em our way on the gitter channel.

About

https://gundbstarter.ggeter.now.sh


Languages

Language:JavaScript 98.7%Language:HTML 1.3%