{"action":"created","comment":{"url":"https://api.github.com/repos/vise890/dropwiki/pulls/comments/40498733","id":40498733,"diff_hunk":"@@ -0,0 +1,148 @@\n+package serve\n+\n+import (\n+\t\"encoding/json\"\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"log\"\n+\t\"net/http\"\n+\t\"os\"\n+\t\"strings\"\n+\t\"text/template\"\n+\n+\t\"github.com/gorilla/mux\"\n+)\n+\n+// node is a node in an indexTree\n+// stealing this from index to search available files\n+\n+const htmlTemplate = `\n+<!DOCTYPE html>\n+<html lang=\"en\">\n+<head>\n+    <meta charset=\"UTF-8\">\n+    <title>{{.Title}}</title>\n+</head>\n+<body>\n+    <div class=\"menu\">\n+        {{.Index}}\n+    </div>\n+    <div class=\"content\">\n+        {{.Content}}\n+    </div>\n+</body>\n+</html>\n+`\n+\n+var T *template.Template\n+\n+func init() {\n+\tT = template.Must(template.New(\"handler\").Parse(htmlTemplate))\n+}\n+\n+func ServeFiles() {","path":"serve/router.go","position":43,"original_position":43,"commit_id":"92618a07ce430b78e667a92e9b179e010a5fdf0d","original_commit_id":"92618a07ce430b78e667a92e9b179e010a5fdf0d","user":{"login":"vise890","id":1628760,"avatar_url":"https://avatars.githubusercontent.com/u/1628760?v=3","gravatar_id":"","url":"https://api.github.com/users/vise890","html_url":"https://github.com/vise890","followers_url":"https://api.github.com/users/vise890/followers","following_url":"https://api.github.com/users/vise890/following{/other_user}","gists_url":"https://api.github.com/users/vise890/gists{/gist_id}","starred_url":"https://api.github.com/users/vise890/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vise890/subscriptions","organizations_url":"https://api.github.com/users/vise890/orgs","repos_url":"https://api.github.com/users/vise890/repos","events_url":"https://api.github.com/users/vise890/events{/privacy}","received_events_url":"https://api.github.com/users/vise890/received_events","type":"User","site_admin":false},"body":"then we can do something else, like expose a function in both the `index` and `serve` packages and do something like\r\n```go\r\nindex.AddHandlers(mux)\r\nserve.AddHandlers(mux)\r\n```\r\nor something","created_at":"2015-09-26T21:52:11Z","updated_at":"2015-09-26T21:52:11Z","html_url":"https://github.com/vise890/dropwiki/pull/4#discussion_r40498733","pull_request_url":"https://api.github.com/repos/vise890/dropwiki/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/vise890/dropwiki/pulls/comments/40498733"},"html":{"href":"https://github.com/vise890/dropwiki/pull/4#discussion_r40498733"},"pull_request":{"href":"https://api.github.com/repos/vise890/dropwiki/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/vise890/dropwiki/pulls/4","id":45737803,"html_url":"https://github.com/vise890/dropwiki/pull/4","diff_url":"https://github.com/vise890/dropwiki/pull/4.diff","patch_url":"https://github.com/vise890/dropwiki/pull/4.patch","issue_url":"https://api.github.com/repos/vise890/dropwiki/issues/4","number":4,"state":"open","locked":false,"title":"Serve files","user":{"login":"maxmcd","id":283903,"avatar_url":"https://avatars.githubusercontent.com/u/283903?v=3","gravatar_id":"","url":"https://api.github.com/users/maxmcd","html_url":"https://github.com/maxmcd","followers_url":"https://api.github.com/users/maxmcd/followers","following_url":"https://api.github.com/users/maxmcd/following{/other_user}","gists_url":"https://api.github.com/users/maxmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/maxmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxmcd/subscriptions","organizations_url":"https://api.github.com/users/maxmcd/orgs","repos_url":"https://api.github.com/users/maxmcd/repos","events_url":"https://api.github.com/users/maxmcd/events{/privacy}","received_events_url":"https://api.github.com/users/maxmcd/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-23T02:06:27Z","updated_at":"2015-09-26T21:52:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e537c260a288218a035c3fffc851276ef5aa70d1","assignee":{"login":"maxmcd","id":283903,"avatar_url":"https://avatars.githubusercontent.com/u/283903?v=3","gravatar_id":"","url":"https://api.github.com/users/maxmcd","html_url":"https://github.com/maxmcd","followers_url":"https://api.github.com/users/maxmcd/followers","following_url":"https://api.github.com/users/maxmcd/following{/other_user}","gists_url":"https://api.github.com/users/maxmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/maxmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxmcd/subscriptions","organizations_url":"https://api.github.com/users/maxmcd/orgs","repos_url":"https://api.github.com/users/maxmcd/repos","events_url":"https://api.github.com/users/maxmcd/events{/privacy}","received_events_url":"https://api.github.com/users/maxmcd/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/vise890/dropwiki/milestones/1","html_url":"https://github.com/vise890/dropwiki/milestones/backend_v0.1","labels_url":"https://api.github.com/repos/vise890/dropwiki/milestones/1/labels","id":1322734,"number":1,"title":"backend_v0.1","description":null,"creator":{"login":"vise890","id":1628760,"avatar_url":"https://avatars.githubusercontent.com/u/1628760?v=3","gravatar_id":"","url":"https://api.github.com/users/vise890","html_url":"https://github.com/vise890","followers_url":"https://api.github.com/users/vise890/followers","following_url":"https://api.github.com/users/vise890/following{/other_user}","gists_url":"https://api.github.com/users/vise890/gists{/gist_id}","starred_url":"https://api.github.com/users/vise890/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vise890/subscriptions","organizations_url":"https://api.github.com/users/vise890/orgs","repos_url":"https://api.github.com/users/vise890/repos","events_url":"https://api.github.com/users/vise890/events{/privacy}","received_events_url":"https://api.github.com/users/vise890/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2015-09-24T19:36:22Z","updated_at":"2015-09-26T21:21:18Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/vise890/dropwiki/pulls/4/commits","review_comments_url":"https://api.github.com/repos/vise890/dropwiki/pulls/4/comments","review_comment_url":"https://api.github.com/repos/vise890/dropwiki/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vise890/dropwiki/issues/4/comments","statuses_url":"https://api.github.com/repos/vise890/dropwiki/statuses/92618a07ce430b78e667a92e9b179e010a5fdf0d","head":{"label":"vise890:serve-files","ref":"serve-files","sha":"92618a07ce430b78e667a92e9b179e010a5fdf0d","user":{"login":"vise890","id":1628760,"avatar_url":"https://avatars.githubusercontent.com/u/1628760?v=3","gravatar_id":"","url":"https://api.github.com/users/vise890","html_url":"https://github.com/vise890","followers_url":"https://api.github.com/users/vise890/followers","following_url":"https://api.github.com/users/vise890/following{/other_user}","gists_url":"https://api.github.com/users/vise890/gists{/gist_id}","starred_url":"https://api.github.com/users/vise890/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vise890/subscriptions","organizations_url":"https://api.github.com/users/vise890/orgs","repos_url":"https://api.github.com/users/vise890/repos","events_url":"https://api.github.com/users/vise890/events{/privacy}","received_events_url":"https://api.github.com/users/vise890/received_events","type":"User","site_admin":false},"repo":{"id":42268225,"name":"dropwiki","full_name":"vise890/dropwiki","owner":{"login":"vise890","id":1628760,"avatar_url":"https://avatars.githubusercontent.com/u/1628760?v=3","gravatar_id":"","url":"https://api.github.com/users/vise890","html_url":"https://github.com/vise890","followers_url":"https://api.github.com/users/vise890/followers","following_url":"https://api.github.com/users/vise890/following{/other_user}","gists_url":"https://api.github.com/users/vise890/gists{/gist_id}","starred_url":"https://api.github.com/users/vise890/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vise890/subscriptions","organizations_url":"https://api.github.com/users/vise890/orgs","repos_url":"https://api.github.com/users/vise890/repos","events_url":"https://api.github.com/users/vise890/events{/privacy}","received_events_url":"https://api.github.com/users/vise890/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vise890/dropwiki","description":"Drop-in wiki serving","fork":false,"url":"https://api.github.com/repos/vise890/dropwiki","forks_url":"https://api.github.com/repos/vise890/dropwiki/forks","keys_url":"https://api.github.com/repos/vise890/dropwiki/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vise890/dropwiki/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vise890/dropwiki/teams","hooks_url":"https://api.github.com/repos/vise890/dropwiki/hooks","issue_events_url":"https://api.github.com/repos/vise890/dropwiki/issues/events{/number}","events_url":"https://api.github.com/repos/vise890/dropwiki/events","assignees_url":"https://api.github.com/repos/vise890/dropwiki/assignees{/user}","branches_url":"https://api.github.com/repos/vise890/dropwiki/branches{/branch}","tags_url":"https://api.github.com/repos/vise890/dropwiki/tags","blobs_url":"https://api.github.com/repos/vise890/dropwiki/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vise890/dropwiki/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vise890/dropwiki/git/refs{/sha}","trees_url":"https://api.github.com/repos/vise890/dropwiki/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vise890/dropwiki/statuses/{sha}","languages_url":"https://api.github.com/repos/vise890/dropwiki/languages","stargazers_url":"https://api.github.com/repos/vise890/dropwiki/stargazers","contributors_url":"https://api.github.com/repos/vise890/dropwiki/contributors","subscribers_url":"https://api.github.com/repos/vise890/dropwiki/subscribers","subscription_url":"https://api.github.com/repos/vise890/dropwiki/subscription","commits_url":"https://api.github.com/repos/vise890/dropwiki/commits{/sha}","git_commits_url":"https://api.github.com/repos/vise890/dropwiki/git/commits{/sha}","comments_url":"https://api.github.com/repos/vise890/dropwiki/comments{/number}","issue_comment_url":"https://api.github.com/repos/vise890/dropwiki/issues/comments{/number}","contents_url":"https://api.github.com/repos/vise890/dropwiki/contents/{+path}","compare_url":"https://api.github.com/repos/vise890/dropwiki/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vise890/dropwiki/merges","archive_url":"https://api.github.com/repos/vise890/dropwiki/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vise890/dropwiki/downloads","issues_url":"https://api.github.com/repos/vise890/dropwiki/issues{/number}","pulls_url":"https://api.github.com/repos/vise890/dropwiki/pulls{/number}","milestones_url":"https://api.github.com/repos/vise890/dropwiki/milestones{/number}","notifications_url":"https://api.github.com/repos/vise890/dropwiki/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vise890/dropwiki/labels{/name}","releases_url":"https://api.github.com/repos/vise890/dropwiki/releases{/id}","created_at":"2015-09-10T20:12:03Z","updated_at":"2015-09-22T15:32:56Z","pushed_at":"2015-09-26T19:02:47Z","git_url":"git://github.com/vise890/dropwiki.git","ssh_url":"git@github.com:vise890/dropwiki.git","clone_url":"https://github.com/vise890/dropwiki.git","svn_url":"https://github.com/vise890/dropwiki","homepage":"","size":10783,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"vise890:master","ref":"master","sha":"57c46d3a5f9beff3034e675e2e978fb614396b9b","user":{"login":"vise890","id":1628760,"avatar_url":"https://avatars.githubusercontent.com/u/1628760?v=3","gravatar_id":"","url":"https://api.github.com/users/vise890","html_url":"https://github.com/vise890","followers_url":"https://api.github.com/users/vise890/followers","following_url":"https://api.github.com/users/vise890/following{/other_user}","gists_url":"https://api.github.com/users/vise890/gists{/gist_id}","starred_url":"https://api.github.com/users/vise890/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vise890/subscriptions","organizations_url":"https://api.github.com/users/vise890/orgs","repos_url":"https://api.github.com/users/vise890/repos","events_url":"https://api.github.com/users/vise890/events{/privacy}","received_events_url":"https://api.github.com/users/vise890/received_events","type":"User","site_admin":false},"repo":{"id":42268225,"name":"dropwiki","full_name":"vise890/dropwiki","owner":{"login":"vise890","id":1628760,"avatar_url":"https://avatars.githubusercontent.com/u/1628760?v=3","gravatar_id":"","url":"https://api.github.com/users/vise890","html_url":"https://github.com/vise890","followers_url":"https://api.github.com/users/vise890/followers","following_url":"https://api.github.com/users/vise890/following{/other_user}","gists_url":"https://api.github.com/users/vise890/gists{/gist_id}","starred_url":"https://api.github.com/users/vise890/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vise890/subscriptions","organizations_url":"https://api.github.com/users/vise890/orgs","repos_url":"https://api.github.com/users/vise890/repos","events_url":"https://api.github.com/users/vise890/events{/privacy}","received_events_url":"https://api.github.com/users/vise890/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vise890/dropwiki","description":"Drop-in wiki serving","fork":false,"url":"https://api.github.com/repos/vise890/dropwiki","forks_url":"https://api.github.com/repos/vise890/dropwiki/forks","keys_url":"https://api.github.com/repos/vise890/dropwiki/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vise890/dropwiki/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vise890/dropwiki/teams","hooks_url":"https://api.github.com/repos/vise890/dropwiki/hooks","issue_events_url":"https://api.github.com/repos/vise890/dropwiki/issues/events{/number}","events_url":"https://api.github.com/repos/vise890/dropwiki/events","assignees_url":"https://api.github.com/repos/vise890/dropwiki/assignees{/user}","branches_url":"https://api.github.com/repos/vise890/dropwiki/branches{/branch}","tags_url":"https://api.github.com/repos/vise890/dropwiki/tags","blobs_url":"https://api.github.com/repos/vise890/dropwiki/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vise890/dropwiki/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vise890/dropwiki/git/refs{/sha}","trees_url":"https://api.github.com/repos/vise890/dropwiki/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vise890/dropwiki/statuses/{sha}","languages_url":"https://api.github.com/repos/vise890/dropwiki/languages","stargazers_url":"https://api.github.com/repos/vise890/dropwiki/stargazers","contributors_url":"https://api.github.com/repos/vise890/dropwiki/contributors","subscribers_url":"https://api.github.com/repos/vise890/dropwiki/subscribers","subscription_url":"https://api.github.com/repos/vise890/dropwiki/subscription","commits_url":"https://api.github.com/repos/vise890/dropwiki/commits{/sha}","git_commits_url":"https://api.github.com/repos/vise890/dropwiki/git/commits{/sha}","comments_url":"https://api.github.com/repos/vise890/dropwiki/comments{/number}","issue_comment_url":"https://api.github.com/repos/vise890/dropwiki/issues/comments{/number}","contents_url":"https://api.github.com/repos/vise890/dropwiki/contents/{+path}","compare_url":"https://api.github.com/repos/vise890/dropwiki/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vise890/dropwiki/merges","archive_url":"https://api.github.com/repos/vise890/dropwiki/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vise890/dropwiki/downloads","issues_url":"https://api.github.com/repos/vise890/dropwiki/issues{/number}","pulls_url":"https://api.github.com/repos/vise890/dropwiki/pulls{/number}","milestones_url":"https://api.github.com/repos/vise890/dropwiki/milestones{/number}","notifications_url":"https://api.github.com/repos/vise890/dropwiki/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vise890/dropwiki/labels{/name}","releases_url":"https://api.github.com/repos/vise890/dropwiki/releases{/id}","created_at":"2015-09-10T20:12:03Z","updated_at":"2015-09-22T15:32:56Z","pushed_at":"2015-09-26T19:02:47Z","git_url":"git://github.com/vise890/dropwiki.git","ssh_url":"git@github.com:vise890/dropwiki.git","clone_url":"https://github.com/vise890/dropwiki.git","svn_url":"https://github.com/vise890/dropwiki","homepage":"","size":10783,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vise890/dropwiki/pulls/4"},"html":{"href":"https://github.com/vise890/dropwiki/pull/4"},"issue":{"href":"https://api.github.com/repos/vise890/dropwiki/issues/4"},"comments":{"href":"https://api.github.com/repos/vise890/dropwiki/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/vise890/dropwiki/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/vise890/dropwiki/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vise890/dropwiki/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/vise890/dropwiki/statuses/92618a07ce430b78e667a92e9b179e010a5fdf0d"}}}}