From b7a0d5afcb5ca84d5e8d7a0d2845571d4bde0876 Mon Sep 17 00:00:00 2001 From: Waleed Ahmed Date: Sat, 29 Apr 2017 20:11:49 -0400 Subject: [PATCH 1/2] Fixed typo in readme module 2 Added .idea folder into .gitignore file --- .gitignore | 1 + module-2/readme.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8817786..308d1a5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ npm-debug.log node_modules/ demo-runthrough +.idea/ diff --git a/module-2/readme.md b/module-2/readme.md index 2b51bbb..b8bc99e 100644 --- a/module-2/readme.md +++ b/module-2/readme.md @@ -199,7 +199,7 @@ app.controller('authController', function($scope){ $scope.register = function(){ //placeholder until authentication is implemented - $scope.error_message = 'registeration request for ' + $scope.user.username; + $scope.error_message = 'registration request for ' + $scope.user.username; }; }); ``` From 674fb4c74a6e36d5748bd0d497b529def107cbe4 Mon Sep 17 00:00:00 2001 From: Waleed Ahmed Date: Sun, 30 Apr 2017 02:03:47 -0400 Subject: [PATCH 2/2] Api code for all posts was shown instead of Api code for specific post --- module-3/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/module-3/README.md b/module-3/README.md index f0e1310..f4284eb 100644 --- a/module-3/README.md +++ b/module-3/README.md @@ -232,22 +232,22 @@ module.exports = router; Now that we got our **/posts** api completed we need to create some apis for individual posts. We can do this by building off of our **/posts** path and adding an ID specific route for an individual post. We use the ':' notation in our route name which tells Express that that particular part of the route will be treated as a parameter: ```js -//api for all posts -router.route('/posts') +//api for a specific post +router.route('/posts/:id') - //create a new post - .post(function(req, res){ - - //TODO create a new post in the database - res.send({message:"TODO create a new post in the database"}); + //create + .put(function(req,res){ + return res.send({message:'TODO modify an existing post by using param ' + req.param.id}); }) - .get(function(req, res){ - - //TODO get all the posts in the database - res.send({message:"TODO get all the posts in the database"}); + .get(function(req,res){ + return res.send({message:'TODO get an existing post by using param ' + req.param.id}); }) + .delete(function(req,res){ + return res.send({message:'TODO delete an existing post by using param ' + req.param.id}) + }); + ``` Finally our full router implementation looks like this: