ssb-fetch
v1.5.2
Published
use fetch to get ssb messages
Downloads
69
Readme
developing with insomnia / postman
Since insomnia and postman can't fetch ssb urls, we get around that by proxying through http.
npm run proxy
To run on a testnet set the ssb_appname
env var as usual (defaults to ssb at ~/.ssb) before running proxy.
export ssb_appname=ssb-test
Creates an http server at http://locahost:4080
In insomnia you can either: http://locahost:4080/ssb://xxx===
or set a base url in your environment:
{
"base_url": "http://localhost:4080/"
}
And then use {{ _.base_url }}ssb://xxx===
If you have a raw sigil id from the database you'll need to convert it to an ssb url. Simplest way is to paste it into the agregore omnibox where it's automatically converted for you. Or programmatically use ssb-uri2 from npm.
readme driven development below (work in progress)
GET is implemented for blobs and json messages; what to do about publishing?
I would prefer to use:
- PUT for uploading blobs
- PUT for new posts (have no root or branch)
- check hash of author,type,content,timestamp-within-range for idempotency?
- POST for replies (root, branch etc) because they can't be truly idempotent; because of the tangle?
- DELETE for removing blobs from local store
- DELETE for tombstoning messages
All the browsers that matter are supporting get, put, post, delete using fetch
html5 forms only support get and post
Would be nice to support html forms so that @cel could potentially use it as per his patchfoo client. What happens currently in agregore when submitting a form?
<form action="" method="get">... name & email inputs</form>
<!-- ?name=bob&email=bob%40bob.com appended to url -->
<form action="" method="post">... name & email inputs</form>
<!-- Content-Type: application/x-www-form-urlencoded -->
<!-- name=bob&email=bob%40bob.com -->
querying by url
querystring api
patchfox, oasis, and patchfoo all seem to have their own ways so that's a good excuse to invent a new standard!