Last active
February 27, 2018 01:11
-
-
Save zacharycarter/3606beb3b5653f21c123d893c42dd2ba 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
curl --request POST \ | |
--url http://localhost:8082/foo \ | |
--header 'content-type: application/json' \ | |
--data '{ | |
"bar": "FOOBAR" | |
}' |
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
var express = require('express'); | |
var bodyParser = require('body-parser'); | |
var Gun = require('gun'); | |
var gun = Gun('http://localhost:8082/gun') | |
gun.get('bar').on(function(data, key){ | |
console.log(data, key) | |
}) | |
var app = express() | |
app.use(Gun.serve) | |
app.listen('8080') |
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
var express = require('express'); | |
var bodyParser = require('body-parser'); | |
var Gun = require('gun'); | |
var gun = Gun('http://localhost:8080/gun') | |
var app = express(); | |
app.use(Gun.serve) | |
app.use(bodyParser.json()) | |
app.post('/foo', function(req, res) { | |
gun.get('bar').put(req.body) | |
res.sendStatus(200) | |
}); | |
gun.get('bar').on(function(data, key){ | |
console.log(data, key) | |
}) | |
app.listen('8082') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment