{"action":"created","comment":{"url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/comments/25576606","id":25576606,"diff_hunk":"@@ -48,80 +60,50 @@ router.get('/app/login-redirect', function(req, res) {\n         var numApps = appList.length;\n         // If the user has only one app, bring them directly to that apps dashboard.\n         if (numApps === 1) {\n-            res.redirect('/app/summary')\n+            var appId = appList[0].app_id\n+            res.redirect('/app/' + appId + '/summary')\n         }\n         // If there are multiple apps, allow the user to select which app they want to look at.\n         else { // numApps > 1\n-            res.redirect('/select-your-app')\n+            res.redirect('/app/select-your-app')\n         }\n     });\n });\n \n /* GET App Data page. */\n-router.get('/app/:appId?/getting-started/', function(req, res) {\n-    repository.getAppList(req.user.user_id, function(appList) {\n-\n-        // Find the requested application.\n-        var appId = parseInt(req.params.appId);\n-        var app = null;\n-        if(appList.length === 1)\n-            app = appList[0];\n-        else\n-            app = appList.find(function(val, index, array){ return val.app_id === appId;});\n-\n-        // If the requested app was found, display the getting-started page.\n-        if(app) {\n-            // Create Content for getting-started\n-            var scriptLocation = '\"http://localhost:3000/client/loquat.js\"';\n-            var script  = '<script src=\"' + scriptLocation + '\"></script>\\n'\n-                + '<script>\\n'\n-                + 'window.lq = new Loquat({app_id: \"' + app.app_id + '\", app_token: \"' + app.app_token + '\"});\\n'\n-                + '</script>';\n+router.get('/app/:appId/getting-started/', function(req, res) {\n+    var app = req.application;\n \n-            // Render getting-started.\n-            res.render('getting-started', {\n-                \"script\": script,\n-                \"app\": app,\n-                \"userName\": req.user.user_name\n-            });\n-        }\n+    var scriptLocation = '\"http://localhost:3000/client/loquat.js\"';\n+    var script  = '<script src=\"' + scriptLocation + '\"></script>\\n'\n+        + '<script>\\n'\n+        + 'window.lq = new Loquat({app_id: \"' + app.app_id + '\", app_token: \"' + app.app_token + '\"});\\n'\n+        + '</script>';\n \n-        // If the requested app was not found, prompt user to select their desired app.\n-        else {\n-            res.redirect('/select-your-app')\n-        }\n+    // Render getting-started.\n+    res.render('getting-started', {\n+        \"script\": script,\n+        \"app\": req.application,\n+        \"userName\": req.user.user_name\n     });\n });\n \n /* GET Summary page. */\n-router.get('/app/:appId?/summary/', function(req, res) {\n-    repository.getAppList(req.user.user_id, function(appList) {\n-        // Insert proper dates\n-        for (var i = 0, imax = appList.length; i < imax; ++i) {\n-            var dt = new Date(appList[i].create_time * 1000);\n-            appList[i].create_date = dt.toUTCString();\n-        }\n-        // Show the summary\n-        res.render('summary', {\n-            \"appList\": appList,\n-            \"userName\": req.user.user_name\n-        });\n+router.get('/app/:appId/summary/', function(req, res) {\n+    // Show the summary\n+    res.render('summary', {\n+        \"app\": req.application,\n+        \"userName\": req.user.user_name\n     });\n });\n \n /* GET Admin page. */\n-router.get('/app/:appId?/admin', function(req, res) {\n-    repository.getAppList(req.user.user_id, function(appList) {\n-        // Insert proper dates\n-        for (var i = 0, imax = appList.length; i < imax; ++i) {\n-            var dt = new Date(appList[i].create_time * 1000);\n-            appList[i].create_date = dt.toUTCString();\n-        }\n-        // Render admin area.\n-        res.render('admin', {\n-            \"appList\": appList,\n-            \"userName\": req.user.user_name\n-        });\n+router.get('/app/:appId/admin', function(req, res) {\n+    console.log(\"the app:\" + JSON.stringify(req.application));\n+    // Render admin area.\n+    res.render('admin', {\n+        \"app\": req.application,","path":"routes/index.js","position":147,"original_position":147,"commit_id":"e2baf2078157ef7abbe4a797230c3519b0f92340","original_commit_id":"e2baf2078157ef7abbe4a797230c3519b0f92340","user":{"login":"mdiehr","id":1588898,"avatar_url":"https://avatars.githubusercontent.com/u/1588898?v=3","gravatar_id":"","url":"https://api.github.com/users/mdiehr","html_url":"https://github.com/mdiehr","followers_url":"https://api.github.com/users/mdiehr/followers","following_url":"https://api.github.com/users/mdiehr/following{/other_user}","gists_url":"https://api.github.com/users/mdiehr/gists{/gist_id}","starred_url":"https://api.github.com/users/mdiehr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdiehr/subscriptions","organizations_url":"https://api.github.com/users/mdiehr/orgs","repos_url":"https://api.github.com/users/mdiehr/repos","events_url":"https://api.github.com/users/mdiehr/events{/privacy}","received_events_url":"https://api.github.com/users/mdiehr/received_events","type":"User","site_admin":false},"body":"use application here","created_at":"2015-03-02T03:09:38Z","updated_at":"2015-03-02T03:09:38Z","html_url":"https://github.com/BDiehr/LoquatAnalytics/pull/41#discussion_r25576606","pull_request_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/41","_links":{"self":{"href":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/comments/25576606"},"html":{"href":"https://github.com/BDiehr/LoquatAnalytics/pull/41#discussion_r25576606"},"pull_request":{"href":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/41"}}},"pull_request":{"url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/41","id":30252433,"html_url":"https://github.com/BDiehr/LoquatAnalytics/pull/41","diff_url":"https://github.com/BDiehr/LoquatAnalytics/pull/41.diff","patch_url":"https://github.com/BDiehr/LoquatAnalytics/pull/41.patch","issue_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues/41","number":41,"state":"open","locked":false,"title":"Feature/app registration","user":{"login":"BDiehr","id":9704604,"avatar_url":"https://avatars.githubusercontent.com/u/9704604?v=3","gravatar_id":"","url":"https://api.github.com/users/BDiehr","html_url":"https://github.com/BDiehr","followers_url":"https://api.github.com/users/BDiehr/followers","following_url":"https://api.github.com/users/BDiehr/following{/other_user}","gists_url":"https://api.github.com/users/BDiehr/gists{/gist_id}","starred_url":"https://api.github.com/users/BDiehr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BDiehr/subscriptions","organizations_url":"https://api.github.com/users/BDiehr/orgs","repos_url":"https://api.github.com/users/BDiehr/repos","events_url":"https://api.github.com/users/BDiehr/events{/privacy}","received_events_url":"https://api.github.com/users/BDiehr/received_events","type":"User","site_admin":false},"body":"Added in app registration as well as seperating the repo from the data-access layer.","created_at":"2015-03-02T00:30:15Z","updated_at":"2015-03-02T03:09:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/41/commits","review_comments_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/41/comments","review_comment_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues/41/comments","statuses_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/statuses/e2baf2078157ef7abbe4a797230c3519b0f92340","head":{"label":"BDiehr:feature/app-registration","ref":"feature/app-registration","sha":"e2baf2078157ef7abbe4a797230c3519b0f92340","user":{"login":"BDiehr","id":9704604,"avatar_url":"https://avatars.githubusercontent.com/u/9704604?v=3","gravatar_id":"","url":"https://api.github.com/users/BDiehr","html_url":"https://github.com/BDiehr","followers_url":"https://api.github.com/users/BDiehr/followers","following_url":"https://api.github.com/users/BDiehr/following{/other_user}","gists_url":"https://api.github.com/users/BDiehr/gists{/gist_id}","starred_url":"https://api.github.com/users/BDiehr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BDiehr/subscriptions","organizations_url":"https://api.github.com/users/BDiehr/orgs","repos_url":"https://api.github.com/users/BDiehr/repos","events_url":"https://api.github.com/users/BDiehr/events{/privacy}","received_events_url":"https://api.github.com/users/BDiehr/received_events","type":"User","site_admin":false},"repo":{"id":29839084,"name":"LoquatAnalytics","full_name":"BDiehr/LoquatAnalytics","owner":{"login":"BDiehr","id":9704604,"avatar_url":"https://avatars.githubusercontent.com/u/9704604?v=3","gravatar_id":"","url":"https://api.github.com/users/BDiehr","html_url":"https://github.com/BDiehr","followers_url":"https://api.github.com/users/BDiehr/followers","following_url":"https://api.github.com/users/BDiehr/following{/other_user}","gists_url":"https://api.github.com/users/BDiehr/gists{/gist_id}","starred_url":"https://api.github.com/users/BDiehr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BDiehr/subscriptions","organizations_url":"https://api.github.com/users/BDiehr/orgs","repos_url":"https://api.github.com/users/BDiehr/repos","events_url":"https://api.github.com/users/BDiehr/events{/privacy}","received_events_url":"https://api.github.com/users/BDiehr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BDiehr/LoquatAnalytics","description":"A javascript based analytics library","fork":false,"url":"https://api.github.com/repos/BDiehr/LoquatAnalytics","forks_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/forks","keys_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/teams","hooks_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/hooks","issue_events_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues/events{/number}","events_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/events","assignees_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/assignees{/user}","branches_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/branches{/branch}","tags_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/tags","blobs_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/statuses/{sha}","languages_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/languages","stargazers_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/stargazers","contributors_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/contributors","subscribers_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/subscribers","subscription_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/subscription","commits_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/contents/{+path}","compare_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/merges","archive_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/downloads","issues_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues{/number}","pulls_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls{/number}","milestones_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/milestones{/number}","notifications_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/labels{/name}","releases_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/releases{/id}","created_at":"2015-01-26T01:06:31Z","updated_at":"2015-02-26T03:50:03Z","pushed_at":"2015-03-02T02:50:54Z","git_url":"git://github.com/BDiehr/LoquatAnalytics.git","ssh_url":"git@github.com:BDiehr/LoquatAnalytics.git","clone_url":"https://github.com/BDiehr/LoquatAnalytics.git","svn_url":"https://github.com/BDiehr/LoquatAnalytics","homepage":null,"size":17752,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":0,"default_branch":"master"}},"base":{"label":"BDiehr:develop","ref":"develop","sha":"c211d88c63d7bb12e7dabd7417fe0cff778c9887","user":{"login":"BDiehr","id":9704604,"avatar_url":"https://avatars.githubusercontent.com/u/9704604?v=3","gravatar_id":"","url":"https://api.github.com/users/BDiehr","html_url":"https://github.com/BDiehr","followers_url":"https://api.github.com/users/BDiehr/followers","following_url":"https://api.github.com/users/BDiehr/following{/other_user}","gists_url":"https://api.github.com/users/BDiehr/gists{/gist_id}","starred_url":"https://api.github.com/users/BDiehr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BDiehr/subscriptions","organizations_url":"https://api.github.com/users/BDiehr/orgs","repos_url":"https://api.github.com/users/BDiehr/repos","events_url":"https://api.github.com/users/BDiehr/events{/privacy}","received_events_url":"https://api.github.com/users/BDiehr/received_events","type":"User","site_admin":false},"repo":{"id":29839084,"name":"LoquatAnalytics","full_name":"BDiehr/LoquatAnalytics","owner":{"login":"BDiehr","id":9704604,"avatar_url":"https://avatars.githubusercontent.com/u/9704604?v=3","gravatar_id":"","url":"https://api.github.com/users/BDiehr","html_url":"https://github.com/BDiehr","followers_url":"https://api.github.com/users/BDiehr/followers","following_url":"https://api.github.com/users/BDiehr/following{/other_user}","gists_url":"https://api.github.com/users/BDiehr/gists{/gist_id}","starred_url":"https://api.github.com/users/BDiehr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BDiehr/subscriptions","organizations_url":"https://api.github.com/users/BDiehr/orgs","repos_url":"https://api.github.com/users/BDiehr/repos","events_url":"https://api.github.com/users/BDiehr/events{/privacy}","received_events_url":"https://api.github.com/users/BDiehr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BDiehr/LoquatAnalytics","description":"A javascript based analytics library","fork":false,"url":"https://api.github.com/repos/BDiehr/LoquatAnalytics","forks_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/forks","keys_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/teams","hooks_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/hooks","issue_events_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues/events{/number}","events_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/events","assignees_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/assignees{/user}","branches_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/branches{/branch}","tags_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/tags","blobs_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/statuses/{sha}","languages_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/languages","stargazers_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/stargazers","contributors_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/contributors","subscribers_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/subscribers","subscription_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/subscription","commits_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/contents/{+path}","compare_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/merges","archive_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/downloads","issues_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues{/number}","pulls_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls{/number}","milestones_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/milestones{/number}","notifications_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/labels{/name}","releases_url":"https://api.github.com/repos/BDiehr/LoquatAnalytics/releases{/id}","created_at":"2015-01-26T01:06:31Z","updated_at":"2015-02-26T03:50:03Z","pushed_at":"2015-03-02T02:50:54Z","git_url":"git://github.com/BDiehr/LoquatAnalytics.git","ssh_url":"git@github.com:BDiehr/LoquatAnalytics.git","clone_url":"https://github.com/BDiehr/LoquatAnalytics.git","svn_url":"https://github.com/BDiehr/LoquatAnalytics","homepage":null,"size":17752,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/41"},"html":{"href":"https://github.com/BDiehr/LoquatAnalytics/pull/41"},"issue":{"href":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues/41"},"comments":{"href":"https://api.github.com/repos/BDiehr/LoquatAnalytics/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BDiehr/LoquatAnalytics/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/BDiehr/LoquatAnalytics/statuses/e2baf2078157ef7abbe4a797230c3519b0f92340"}}}}