{"action":"created","comment":{"url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/comments/30770493","id":30770493,"diff_hunk":"@@ -1,3 +1,118 @@\n-// connect to mongodb in this module as this is where you'll be making creat/read/delete calls to your database\r\n+// connect to mongodb in this module as this is where you'll be making create/read/delete calls to your database\r\n // use 'mongodb://localhost/foodTruckAPI' for your mongoose connection string\r\n // remember this is a Node module\r\n+var express = require('express');\r\n+var app = express.router();\r\n+\r\n+// mongoose is just another node module\r\n+var mongoose = require('mongoose');\r\n+var db = mongoose.connect('mongodb://localhost/trucksAPI');\r\n+var bodyParser = require('body-parser');\r\n+\r\n+var Truck = require('./models/truckModel');\r\n+var idManager = require('./idManager');\r\n+\r\n+idManager.setIds(trucks.getTrucks());\r\n+var serveStatic = express.static('public');\r\n+app.use(serveStatic);\r\n+\r\n+app.use(bodyParser.urlencoded({ extended: true }));\r\n+app.use(bodyParser.json());\r\n+\r\n+//A GET route for '/trucks' that sends to the response the list of all food-truck objects in JSON format.\r\n+app.get('/trucks', function (request, response){\r\n+    \r\n+    var query = request.query;\r\n+    \r\n+    if (request.query.name) {\r\n+      query.name = request.query.name;\r\n+    }\r\n+    if (request.query.foodType) {\r\n+      query.foodType = request.query.foodType;\r\n+    }\r\n+    if (request.query.schedule) {\r\n+      query.schedule = request.query.schedule;\r\n+    }\r\n+  \r\n+    Truck.find(function(error, books){\r\n+      if (error) {\r\n+          response.status(500).send(error);\r\n+      }else{\r\n+        response.json(trucks);\r\n+      }\r\n+});\r\n+\r\n+//A GET route for '/trucks/:name' that sends to the response the matching food-truck object in JSON format.\r\n+app.get('/trucks/:name', function (request, response) {\r","path":"routes/truckRoutes.js","position":47,"original_position":47,"commit_id":"28e1581a9e77beab45ec74abae1f68cde1b4042a","original_commit_id":"28e1581a9e77beab45ec74abae1f68cde1b4042a","user":{"login":"jamdon","id":10747092,"avatar_url":"https://avatars.githubusercontent.com/u/10747092?v=3","gravatar_id":"","url":"https://api.github.com/users/jamdon","html_url":"https://github.com/jamdon","followers_url":"https://api.github.com/users/jamdon/followers","following_url":"https://api.github.com/users/jamdon/following{/other_user}","gists_url":"https://api.github.com/users/jamdon/gists{/gist_id}","starred_url":"https://api.github.com/users/jamdon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamdon/subscriptions","organizations_url":"https://api.github.com/users/jamdon/orgs","repos_url":"https://api.github.com/users/jamdon/repos","events_url":"https://api.github.com/users/jamdon/events{/privacy}","received_events_url":"https://api.github.com/users/jamdon/received_events","type":"User","site_admin":false},"body":"This route is using an id as the dynamic portion of the route, so naming it id or truckId, or something along those lines would be better.","created_at":"2015-05-21T03:28:04Z","updated_at":"2015-05-21T03:28:04Z","html_url":"https://github.com/JSCRIPT300-Spring2015/Module_5/pull/14#discussion_r30770493","pull_request_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/comments/30770493"},"html":{"href":"https://github.com/JSCRIPT300-Spring2015/Module_5/pull/14#discussion_r30770493"},"pull_request":{"href":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/14","id":35593875,"html_url":"https://github.com/JSCRIPT300-Spring2015/Module_5/pull/14","diff_url":"https://github.com/JSCRIPT300-Spring2015/Module_5/pull/14.diff","patch_url":"https://github.com/JSCRIPT300-Spring2015/Module_5/pull/14.patch","issue_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/issues/14","number":14,"state":"open","locked":false,"title":"Tyler Waite's Module 5 updated files sync","user":{"login":"tylerw8","id":9169939,"avatar_url":"https://avatars.githubusercontent.com/u/9169939?v=3","gravatar_id":"","url":"https://api.github.com/users/tylerw8","html_url":"https://github.com/tylerw8","followers_url":"https://api.github.com/users/tylerw8/followers","following_url":"https://api.github.com/users/tylerw8/following{/other_user}","gists_url":"https://api.github.com/users/tylerw8/gists{/gist_id}","starred_url":"https://api.github.com/users/tylerw8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylerw8/subscriptions","organizations_url":"https://api.github.com/users/tylerw8/orgs","repos_url":"https://api.github.com/users/tylerw8/repos","events_url":"https://api.github.com/users/tylerw8/events{/privacy}","received_events_url":"https://api.github.com/users/tylerw8/received_events","type":"User","site_admin":false},"body":"Sync of Module 5 updated files","created_at":"2015-05-17T21:41:36Z","updated_at":"2015-05-21T03:28:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb2348af879057c755f05afe80493949060debe8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/14/commits","review_comments_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/14/comments","review_comment_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/issues/14/comments","statuses_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/statuses/28e1581a9e77beab45ec74abae1f68cde1b4042a","head":{"label":"tylerw8:master","ref":"master","sha":"28e1581a9e77beab45ec74abae1f68cde1b4042a","user":{"login":"tylerw8","id":9169939,"avatar_url":"https://avatars.githubusercontent.com/u/9169939?v=3","gravatar_id":"","url":"https://api.github.com/users/tylerw8","html_url":"https://github.com/tylerw8","followers_url":"https://api.github.com/users/tylerw8/followers","following_url":"https://api.github.com/users/tylerw8/following{/other_user}","gists_url":"https://api.github.com/users/tylerw8/gists{/gist_id}","starred_url":"https://api.github.com/users/tylerw8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylerw8/subscriptions","organizations_url":"https://api.github.com/users/tylerw8/orgs","repos_url":"https://api.github.com/users/tylerw8/repos","events_url":"https://api.github.com/users/tylerw8/events{/privacy}","received_events_url":"https://api.github.com/users/tylerw8/received_events","type":"User","site_admin":false},"repo":{"id":35392962,"name":"Module_5","full_name":"tylerw8/Module_5","owner":{"login":"tylerw8","id":9169939,"avatar_url":"https://avatars.githubusercontent.com/u/9169939?v=3","gravatar_id":"","url":"https://api.github.com/users/tylerw8","html_url":"https://github.com/tylerw8","followers_url":"https://api.github.com/users/tylerw8/followers","following_url":"https://api.github.com/users/tylerw8/following{/other_user}","gists_url":"https://api.github.com/users/tylerw8/gists{/gist_id}","starred_url":"https://api.github.com/users/tylerw8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylerw8/subscriptions","organizations_url":"https://api.github.com/users/tylerw8/orgs","repos_url":"https://api.github.com/users/tylerw8/repos","events_url":"https://api.github.com/users/tylerw8/events{/privacy}","received_events_url":"https://api.github.com/users/tylerw8/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tylerw8/Module_5","description":"Module_5 assignment repository","fork":true,"url":"https://api.github.com/repos/tylerw8/Module_5","forks_url":"https://api.github.com/repos/tylerw8/Module_5/forks","keys_url":"https://api.github.com/repos/tylerw8/Module_5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tylerw8/Module_5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tylerw8/Module_5/teams","hooks_url":"https://api.github.com/repos/tylerw8/Module_5/hooks","issue_events_url":"https://api.github.com/repos/tylerw8/Module_5/issues/events{/number}","events_url":"https://api.github.com/repos/tylerw8/Module_5/events","assignees_url":"https://api.github.com/repos/tylerw8/Module_5/assignees{/user}","branches_url":"https://api.github.com/repos/tylerw8/Module_5/branches{/branch}","tags_url":"https://api.github.com/repos/tylerw8/Module_5/tags","blobs_url":"https://api.github.com/repos/tylerw8/Module_5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tylerw8/Module_5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tylerw8/Module_5/git/refs{/sha}","trees_url":"https://api.github.com/repos/tylerw8/Module_5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tylerw8/Module_5/statuses/{sha}","languages_url":"https://api.github.com/repos/tylerw8/Module_5/languages","stargazers_url":"https://api.github.com/repos/tylerw8/Module_5/stargazers","contributors_url":"https://api.github.com/repos/tylerw8/Module_5/contributors","subscribers_url":"https://api.github.com/repos/tylerw8/Module_5/subscribers","subscription_url":"https://api.github.com/repos/tylerw8/Module_5/subscription","commits_url":"https://api.github.com/repos/tylerw8/Module_5/commits{/sha}","git_commits_url":"https://api.github.com/repos/tylerw8/Module_5/git/commits{/sha}","comments_url":"https://api.github.com/repos/tylerw8/Module_5/comments{/number}","issue_comment_url":"https://api.github.com/repos/tylerw8/Module_5/issues/comments{/number}","contents_url":"https://api.github.com/repos/tylerw8/Module_5/contents/{+path}","compare_url":"https://api.github.com/repos/tylerw8/Module_5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tylerw8/Module_5/merges","archive_url":"https://api.github.com/repos/tylerw8/Module_5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tylerw8/Module_5/downloads","issues_url":"https://api.github.com/repos/tylerw8/Module_5/issues{/number}","pulls_url":"https://api.github.com/repos/tylerw8/Module_5/pulls{/number}","milestones_url":"https://api.github.com/repos/tylerw8/Module_5/milestones{/number}","notifications_url":"https://api.github.com/repos/tylerw8/Module_5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tylerw8/Module_5/labels{/name}","releases_url":"https://api.github.com/repos/tylerw8/Module_5/releases{/id}","created_at":"2015-05-11T00:00:46Z","updated_at":"2015-05-11T00:00:46Z","pushed_at":"2015-05-17T21:39:24Z","git_url":"git://github.com/tylerw8/Module_5.git","ssh_url":"git@github.com:tylerw8/Module_5.git","clone_url":"https://github.com/tylerw8/Module_5.git","svn_url":"https://github.com/tylerw8/Module_5","homepage":null,"size":69,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"JSCRIPT300-Spring2015:master","ref":"master","sha":"6f0d280fc8760d2516de6cc638cc6c35df091be5","user":{"login":"JSCRIPT300-Spring2015","id":11728112,"avatar_url":"https://avatars.githubusercontent.com/u/11728112?v=3","gravatar_id":"","url":"https://api.github.com/users/JSCRIPT300-Spring2015","html_url":"https://github.com/JSCRIPT300-Spring2015","followers_url":"https://api.github.com/users/JSCRIPT300-Spring2015/followers","following_url":"https://api.github.com/users/JSCRIPT300-Spring2015/following{/other_user}","gists_url":"https://api.github.com/users/JSCRIPT300-Spring2015/gists{/gist_id}","starred_url":"https://api.github.com/users/JSCRIPT300-Spring2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JSCRIPT300-Spring2015/subscriptions","organizations_url":"https://api.github.com/users/JSCRIPT300-Spring2015/orgs","repos_url":"https://api.github.com/users/JSCRIPT300-Spring2015/repos","events_url":"https://api.github.com/users/JSCRIPT300-Spring2015/events{/privacy}","received_events_url":"https://api.github.com/users/JSCRIPT300-Spring2015/received_events","type":"Organization","site_admin":false},"repo":{"id":35251866,"name":"Module_5","full_name":"JSCRIPT300-Spring2015/Module_5","owner":{"login":"JSCRIPT300-Spring2015","id":11728112,"avatar_url":"https://avatars.githubusercontent.com/u/11728112?v=3","gravatar_id":"","url":"https://api.github.com/users/JSCRIPT300-Spring2015","html_url":"https://github.com/JSCRIPT300-Spring2015","followers_url":"https://api.github.com/users/JSCRIPT300-Spring2015/followers","following_url":"https://api.github.com/users/JSCRIPT300-Spring2015/following{/other_user}","gists_url":"https://api.github.com/users/JSCRIPT300-Spring2015/gists{/gist_id}","starred_url":"https://api.github.com/users/JSCRIPT300-Spring2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JSCRIPT300-Spring2015/subscriptions","organizations_url":"https://api.github.com/users/JSCRIPT300-Spring2015/orgs","repos_url":"https://api.github.com/users/JSCRIPT300-Spring2015/repos","events_url":"https://api.github.com/users/JSCRIPT300-Spring2015/events{/privacy}","received_events_url":"https://api.github.com/users/JSCRIPT300-Spring2015/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JSCRIPT300-Spring2015/Module_5","description":"Module_5 assignment repository","fork":false,"url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5","forks_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/forks","keys_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/teams","hooks_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/hooks","issue_events_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/issues/events{/number}","events_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/events","assignees_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/assignees{/user}","branches_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/branches{/branch}","tags_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/tags","blobs_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/git/refs{/sha}","trees_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/statuses/{sha}","languages_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/languages","stargazers_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/stargazers","contributors_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/contributors","subscribers_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/subscribers","subscription_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/subscription","commits_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/commits{/sha}","git_commits_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/git/commits{/sha}","comments_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/comments{/number}","issue_comment_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/issues/comments{/number}","contents_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/contents/{+path}","compare_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/merges","archive_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/downloads","issues_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/issues{/number}","pulls_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls{/number}","milestones_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/milestones{/number}","notifications_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/labels{/name}","releases_url":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/releases{/id}","created_at":"2015-05-08T01:23:00Z","updated_at":"2015-05-08T07:30:48Z","pushed_at":"2015-05-20T05:10:41Z","git_url":"git://github.com/JSCRIPT300-Spring2015/Module_5.git","ssh_url":"git@github.com:JSCRIPT300-Spring2015/Module_5.git","clone_url":"https://github.com/JSCRIPT300-Spring2015/Module_5.git","svn_url":"https://github.com/JSCRIPT300-Spring2015/Module_5","homepage":null,"size":785,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":2,"forks":22,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/14"},"html":{"href":"https://github.com/JSCRIPT300-Spring2015/Module_5/pull/14"},"issue":{"href":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/issues/14"},"comments":{"href":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/JSCRIPT300-Spring2015/Module_5/statuses/28e1581a9e77beab45ec74abae1f68cde1b4042a"}}}}