zeke / queriac

An experiment...
4 stars 5 forks source link

Create Github proxy server #4

Closed rwdaigle closed 9 years ago

rwdaigle commented 9 years ago

From tweet:

Stand up a CORS webservice that serves up all files in a github repo as a key-value JSON object

rwdaigle commented 9 years ago

@zeke are you thinking something like this?

$ curl https://ghproxy.herokuapp.com/v1/zeke/queriac.json
{
  ".gitignore": "full body of file...",
  "README.md": "full body of file..."
}

Where the file contents are part of the JSON response?

And what about directories, how are those handled?

zeke commented 9 years ago

Yep, that's what I'm picturing! But js files only, and no directories. Flat.

zeke commented 9 years ago

If you're building this thing in node, the npm-cdn codebase might be helpful: https://github.com/zeke/npm-cdn

The way I would do this is to pull down a repo tarball and extract it to /tmp, rather than futzing with the github API. But I'll take what I can get!

rwdaigle commented 9 years ago

:+1:

I'll see what I can do...

rwdaigle commented 9 years ago

@zeke how does this look?

$ curl https://queriac-github-proxy.herokuapp.com/v1/zeke/queriac-commands
{
  "_commands.js": "var basicCSV = ...",
  "a.js": "// Search Amazon\n\n/*\nSearches all of amazon.com\n*/\n\nlocation = \"http://www.amazon.com/s/ref=nb_sb_noss_2?field-keywords=\"+args.join(\" \")\n",
  "acr.js": "..."
}

Repo here

zeke commented 9 years ago

:clap:

rwdaigle commented 9 years ago

@zeke it's very raw, so let me know when it starts to be limiting.