24 ms·
Show HN: Rasta.js, anonymous domainless key-value store for frontend JavaScript
- bouncingsoul 15y agoYou might want to look at http://openkeyval.org http://openkeyval.org if you weren't aware of it. Exact same idea. (HN discussion: http://news.ycombinator.com/item?id=1846088 http://news.ycombinator.com/item?id=1846088)
- famsam 15y agoThe linked-to site appears to be fraudulent. If you manage to make it through the pester screens, what do they do with your key value pairs.
- david927 15y agoFantastic! I needed that.
- pitra 15y agome too, that's why I made it
- netlemurde 15y agowhat are you using it for? still don't really get it...
- pitra 15y agonothing yet, I just wrote it. But basically, the idea is, you no longer need a backend to store some simple data.
- maroufle 15y agohow does it work ?
- pitra 15y agoyou just include a <script> tag, and then use the API.
- josscrowcroft 15y agoI think he meant - physically, HOW does this work. As in, where is the data stored and how?
- pitra 15y agooh, my bad. Well, the API doesn't specify anything beyond that. My implementation is on GitHub at https://github.com/errorjs/Rasta.js https://github.com/errorjs/Rasta.js
- lyime 15y agoIs this OSS? If so, where is the un-minified version and repository?
- pitra 15y agoUnminified JS: http://rastajs.errorjs.com/rasta.js http://rastajs.errorjs.com/rasta.js I am putting it on GitHub right now.
- lars 15y agoI looked at the code, and what this does is to make calls to a web api on the errorjs.com domain. It sets a key using: http://rastajs.errorjs.com/set/yourkey/yourvalue http://rastajs.errorjs.com/set/yourkey/yourvalue And retrieves it using: http://rastajs.errorjs.com/get/yourkey http://rastajs.errorjs.com/get/yourkey It also adds a timestamp, and allows for a callback. Perhaps it should be clarified that this relies on making a web call to their server (even if that is the only way this could possibly be done).
- pitra 15y agoThanks. I should be more clear about that. The api is defined under WHY? tab, btw.
- catshirt 15y agoawesome! like someone else said, this is a great tool for prototyping, and likely other projects. tinydb is pretty cool as well. http://tinydb.org/ http://tinydb.org/
- pkulak 15y agoDo keys need to be globally unique?
- pitra 15y agoEverything is in the same namespace.
- moonlighter 15y agoIt would be a heck of a lot more useful if it were namespaced, like S3's buckets. Let folks put into those buckets whatever they want, but make the buckets in your datastore unique, based on the domain, referer, etc.
- HoLyVieR 15y agoUnless there is something I don't understand, how can this even be slightly reliable or useful, when everyone can read any key and write or replace any key at any moment ?
- pitra 15y agoIt's not meant to be reliable. Nor is it meant to be secure. It's a direct connection to a data store.
- guptaneil 15y agoI guess I could see some usefulness in a quick weekend prototyping to get a persistent app up and running.
- Groxx 15y agobut then why would this be better than, say, localStorage, which is local? The only purpose to this is semi-persistent cross-domain information storage. It's crazy to use an external JSON-P service to store tweetable-sized messages, when you've got megabytes locally with precisely the same key/value setup. Or, if you're handling older browsers, cookies will get you several KB.
- guptaneil 15y agoIf you want to demonstrate some cross-browser communication app? I agree, this has a very limited application scope. I am more confused as to why the author made it when he doesn't seem to have a use case for it himself.
- NHQ 15y agoAnd also replace a value with normal, arbitrary javascript... Still, neat idea.
- hamrickdavid 15y agoGood use of Twitter's new Bootstrap framework http://twitter.github.com/bootstrap/ http://twitter.github.com/bootstrap/
- pbreit 15y agoWould it make sense for "set" to be a POST? Or does that compromise "easy"?
- HoLyVieR 15y agoIt would make sense in theory, but in practice you can't make POST request to a JSONP API. So that's why you have to stick to GET request.
- tchvil 15y agoYou can make a cross domain POST with an IFRAME but would not get the response directly. Having to use parent.postMessage, the window.name hack or polling with JSONP depending on the browser. Possible then, but not so easy.
- HoLyVieR 15y agoThose hacks don't work on all platform (iframe for mobile is a good example) and often require you to have very particular setting on both sites. The only way for JSONP to work well on everything is to use script tag injection which only allows you to do GET request.
- tchvil 15y agoThis works well on iPhone and Android mobiles. And has the same level of particular settings as JSONP.
- marcamillion 15y agoI guess I am not geek enough, but the description for this is SOOO opaque. I have no idea what this does - and I am a web developer! Can someone explain, in simple English, what this is about and why it's good?
- Udo 15y agoIt's a javascript library that essentially consists of two functions (get and set) to retrieve and store some arbitrary content identified by a key string. That content is stored on the author's server though you can override the domain name and put in your own. I think this combination of a lightweight library and free online storage could be useful for people who would like to have a static website with no functionality or storage whatsoever on their server. It could also be used in scenarios where JS code is used as glue between one or more websites and the user (for example in browser plugins).
- amasad 15y agoThere is a typo on the "FOR DUMMIES" section, "This is a key-value date store"
- iamtherockstar 15y agoI think there's a pretty limited use for this, but it's definitely an interesting experiment if nothing else. I found it so cute that I decided I'd implement a really simple server endpoint for this. https://github.com/rockstar/selassie https://github.com/rockstar/selassie It's not backed by anything but memory, but that's why I said "simple".
- nikcub 15y agoHe has his own backend, written in js and also backed by redis within the package: https://github.com/errorjs/Rasta.js/blob/master/web.js https://github.com/errorjs/Rasta.js/blob/master/web.js