<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rest on Bruno Pedro</title><link>https://brunopedro.com/tags/rest/</link><description>Recent content in Rest on Bruno Pedro</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 23 Apr 2018 14:57:11 +0200</lastBuildDate><atom:link href="https://brunopedro.com/tags/rest/index.xml" rel="self" type="application/rss+xml"/><item><title>JavaScript filesystem database</title><link>https://brunopedro.com/2010/12/21/javascript-fs-db/</link><pubDate>Tue, 21 Dec 2010 18:33:00 +0000</pubDate><guid>https://brunopedro.com/2010/12/21/javascript-fs-db/</guid><description>&lt;p>I couldn&amp;rsquo;t resist and, after many conversations with &lt;a href="http://mvalente.eu/" title="Mário Valente">Mário Valente&lt;/a>, I challenged myself to build a complete JavaScript filesystem based database from scratch. In short, something like &lt;a href="http://couchdb.org" title="CouchDB">CouchDB&lt;/a> but written in JavaScript and using a filesystem approach for document storage.&lt;/p>
&lt;p>Some characteristics of this new database system:&lt;/p>
&lt;ul>
&lt;li>fully written in JavaScript: &lt;a href="http://nodejs.org/" title="nodeJS">nodeJS&lt;/a> is my choice for its architecture and portability;&lt;/li>
&lt;li>every document must contain only &lt;a href="http://www.json.org/" title="JSON">JSON&lt;/a> data;&lt;/li>
&lt;li>every document can be manipulated on the filesystem: the idea is to allow someone to edit a document using &lt;a href="http://www.vim.org/" title="vim">vim&lt;/a>, for instance, without breaking anything. It also lets you easily backup, move or replicate your data without creating a heavy load on the database;&lt;/li>
&lt;li>the underlying filesystem can be changed: changing the underlying filesystem offers numerous possibilities, like easy distribution (using &lt;a href="http://www.openafs.org/" title="OpenAFS">OpenAFS&lt;/a>, &lt;a href="http://www.xtreemfs.org/" title="XTREEMFS">XTREEMFS&lt;/a> or others), replication (using &lt;a href="http://code.google.com/p/finefs/" title="finefs">finefs&lt;/a> or others), and even attaching different backends (using &lt;a href="http://fuse.sourceforge.net/" title="FUSE">FUSE&lt;/a>, for example);&lt;/li>
&lt;li>the system must be available through an HTTP &lt;a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" title="REST">REST&lt;/a> interface: this makes it very easy to immediately integrate the system into any existing applications. Bonus points if the API is compatible with CouchDB;&lt;/li>
&lt;li>queries must be performed using a &lt;a href="http://en.wikipedia.org/wiki/MapReduce" title="MapReduce">MapReduce&lt;/a> approach: this should make it very easy to perform queries on a large dataset.&lt;/li>
&lt;/ul>
&lt;p>So, right now I&amp;rsquo;m half way through it. I managed to write the backend and I&amp;rsquo;m on my way to the HTTP REST interface. I&amp;rsquo;ll create a github repo after I have something functional that can be easily built and tested.&lt;/p></description></item><item><title>To REST or not to REST</title><link>https://brunopedro.com/2009/07/20/to-rest-or-not-to-rest/</link><pubDate>Mon, 20 Jul 2009 08:41:51 +0000</pubDate><guid>https://brunopedro.com/2009/07/20/to-rest-or-not-to-rest/</guid><description>&lt;p>Yesterday &lt;a href="http://twitter.com/esjewett" title="esjewett on twitter">@esjewett&lt;/a> &lt;a href="http://twitter.com/esjewett/status/2723828400">pointed out&lt;/a> that &lt;a href="http://tarpipe.com/">tarpipe&lt;/a>&amp;rsquo;s API 2.0 might not be considered RESTful. Quoting the previously written article &amp;ldquo;&lt;a href="http://www.esjewett.com/blog/a-restful-esme-api">A RESTful ESME API&lt;/a>&amp;rdquo;:&lt;/p>
&lt;blockquote>
&lt;p>REST is often seen as an alternative to RPC APIs, or &amp;ldquo;Remote Procedure Call&amp;rdquo; APIs. At root, the difference as described by Wikipedia is that RPC is about telling an application to do something while REST is about changing the state of the resources of an application.&lt;/p>
&lt;/blockquote>
&lt;span class="entry-published">
 &lt;span class="entry-author author vcard">
 &lt;span class="fn n">&lt;a href="http://www.theamazingrando.com/">Paul Sadauskas&lt;/a>, on &lt;a href="http://www.theamazingrando.com/blog/?p=107">another article&lt;/a> about the same subject, adds some rules that your API &lt;strong>should not&lt;/strong> follow:&lt;/span>
&lt;/span>
&lt;/span>
&lt;blockquote>
&lt;ol>
&lt;li>Clients have to read documentation to know the locations of top-level resources.&lt;/li>
&lt;li>Clients have to concatenate strings to get to the next resource.&lt;/li>
&lt;li>You have an &amp;ldquo;API/Key/Token&amp;rdquo; in a header or a url.&lt;/li>
&lt;li>You have a version string in a url.&lt;/li>
&lt;/ol>
&lt;/blockquote>
&lt;p>All this made me think about possible changes to become RESTful. Things seem to be easy when you&amp;rsquo;re offering operations to resources you own or control. When you&amp;rsquo;re dealing with processes that&amp;rsquo;s a whole different story. As &lt;a href="http://twitter.com/esjewett" title="esjewett on twitter">@esjewett&lt;/a> best &lt;a href="http://twitter.com/esjewett/status/2724662905">puts it&lt;/a>:&lt;/p></description></item></channel></rss>