Last active
March 22, 2017 05:26
-
-
Save zwhitchcox/b1e79e3e3cdd3376e8d7fa33c317b9d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express') | |
| const http = require('http') | |
| const Gun = require('gun') | |
| const app = express() | |
| const server = http.createServer(app) | |
| Gun({file: 'data.json', web: app}) | |
| app.use(Gun.serve) | |
| app.get('/', function (req, res) { | |
| res.end(` | |
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>Gun - React Examples</title> | |
| </head> | |
| <body> | |
| <script src="http://rawgit.com/amark/gun/master/gun.js"></script> | |
| <script> | |
| var gun = Gun(location.origin+'/gun') | |
| var todos = gun.get('todos') | |
| todos.on(function(todos){console.log(todos)}) | |
| </script> | |
| </body> | |
| </html> | |
| `)}) | |
| server.listen(4000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment