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; }; }); ``` 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: