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
dir structure: | |
/lib/ | |
/tmp/ | |
/views/ | |
/public/ | |
/config.ru | |
/blog.rb | |
-- |
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
/* | |
I want to be able to build a DSL for node.js so that I can define app routes for an HTTP interface like this: | |
*/ | |
{ | |
"/blog" : { | |
GET: function(request) { | |
// List blog posts | |
}, |
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
#(entry point) | |
> GET / | |
< 200 OK | |
< Link: </lists/some-list>; rel="http://example.com/rels/list", | |
< </foobars/another-list>; rel="http://example.com/rels/list" | |
< {...} | |
<html> | |
<head> |
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
(GET /list) | |
<link rel="self" href="/list"> | |
<link rel="description" href="/list/description" /> | |
<link rel="search" href="/list/search/{search_term}" /> | |
<created_at>2010-01-16</created_at> | |
<updated_at>2010-02-21</updated_at> | |
<summary>An example list</summary> | |
<link rel="owner" href="/people/mike"> | |
<name>Mike</name> |
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
# Critical default settings: | |
disable_system_gems | |
disable_rubygems | |
bundle_path '.gems/bundler_gems' | |
# List gems to bundle here: | |
gem 'rails_dm_datastore' | |
gem 'rails', "2.3.5" | |
# Needed for Devise-Plugin |
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
// (/app/resources/useraccount.js) | |
Resource({ | |
respond_to: ["html", "xml", "json"], | |
http: { | |
GET: function() { | |
user = User.find(params.user); | |
respond_with(user); | |
}, | |
PUT: function() { |
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
<resource rel="self" href="/list"> | |
<resource rel="description" href="/list/description" /> | |
<resource rel="search" href="/list/search/{search_term}" /> | |
<created_at>2010-01-16</created_at> | |
<updated_at>2010-02-21</updated_at> | |
<summary>An example list</summary> | |
<resource rel="owner" href="/people/mike"> | |
<name>Mike</name> | |
<age>36</age> | |
</resource> |
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
<resource href="/orders"> | |
<link rel="next" href="/orders?page=2" /> | |
<link rel="search" href="/orders?id={order_id}" /> | |
<resource rel="order" href="/orders/123"> | |
<link rel="customer" href="/customer/bob" title="Bob Jones <[email protected]>" /> | |
<resource rel="basket" href="/orders/123/basket"> | |
<item> | |
<sku>ABC123</sku> | |
<quantity>2</quantity> | |
<price>9.50</price> |
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
{ | |
"_links" : { | |
"search" : { "href" : "/todo-list/search;{searchterm}" }, | |
"description" : { "href" : "/todo-list/description" } | |
}, | |
"_embedded" : { | |
"owner" : { | |
"_links" : { | |
"self" : { "href" : "http://range14sux.com/mike"}, | |
"friend" : { "href": "http://mamund.com/" } |
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
<html> | |
<head> | |
<title>Example of HTTP microformat</title> | |
</head> | |
<body> | |
<div class="http"> | |
<div class="request"> | |
<div class="line"> | |
<span class="method">POST</span> <span class="resource">/foo/bar</span> <span class="http-version">HTTP/1.1</span> | |
</div> |
OlderNewer