SparkartGroupInc/solidus — pull request #74 by Fauntleroy (2013-11-13 23:22:05+00:00)
Title: Centralized resources

Lets developers define resources "globally" with a `resources.json` file. This file has 2 keys: `resources` and `options`. `resources` is an object of resource data that operates exactly like the resources definition inside page configurations. `options` is an object of resource options that are mixed into existing resource definitions (in `resources.json` or page configurations). The keys here are strings that match `url`s with a wildcard (`*`), and the values are the options which you wish to set (right now that's just `headers` and `auth`).

Here's the `resources.json` I worked with in my example site:

```json
{
"resources": {
"profile": {
"url": "http://staging.proxy.storyteller.io/Fauntleroy/soundcloud/users/fauntlero-von-patton.json"
},
"favorites": {
"url": "http://staging.proxy.storyteller.io/Fauntleroy/soundcloud/users/fauntlero-von-patton/favorites.json"
}
},
"options": {
"http://staging.proxy.storyteller.io/*": {
"headers": {
"Api-Key": "e801cf0a-ee44-42d3-a29f-aff82fd0521b"
}
}
}
}
```

I'm not really a huge fan of how this has ended up, but it works. I'd love some suggestions, or maybe a different approach altogether...