{"push_id":1636649410,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"787b1a8a5fca47d4f79b06c4530f9d91b4c9345a","before":"63945ae7c953da04987824624e59ca9e2ad4ec29","commits":[{"sha":"787b1a8a5fca47d4f79b06c4530f9d91b4c9345a","author":{"name":"Serge","email":"b1af7fa8f81697b7c68d43b2fbdd1b90afb3605a@gmail.com"},"message":"---------------------------Exerice: Angular ngResource module and $resrouce service---------------------------\nIn this exercise we changed up angular core $http service with an external (needed to be downloaded)\nngResource module and $resource service that leverages $htttp protocol to access a RESful API Server.\n\nWeb Services: A system designed to support interoperability (abilit of sofware to ex hange and make use of\ninfo) of systems connected of a network. Service Oriented Architecture (SOA, standarizedway of integrating web-\nbased apps usings open stndards operating over the internet. 2 standards: Soap and REST\n\nREST: WWW was successful b/c hyperlinks aloud to refer to other resources in the internet using url\nREST is a style of 'software architecture' for distributed hyperedia systems such as the www\nIntroduced by Roy Fielding\nA collection of network architecture principles which outline how resources are defined and addressed.\nResoureces reffered using hyperlinks\n1) itendify resoruecs 2) address resources 3)perform operations on resorouces\n4 design principles of REST:\nA) use http methods explliicitly\nB) be stateless\nC) expose directory structure-like URIs\nD) JSON\n\"The motivation for REST was to capture the characteristics of the Web that made the Web Successful\"\nURI Accesssible Resources\n\nResources: key abstraction of information in REST, a \"conceptual mapping to a set of enteties\"\n-represented witha global indentifier = URI\nGet - Read\nPost - Create\nPut - Update\nDelete - Delete\n\nRepresentations: JSON, how data is represented or returned to the client. We transform data in a way that can be\ntransported accroes to the client side or vice versa in a format both sides can udnerstand.\nrepsresentation: the represented info that is xported across from one side to another is JSON\n*** JSON has become the representational standard for information interchange ***\n\n$resource service: higher level of abstraction than the $http service, facilitates communication w/server\nthat exports RESTful API\n-not part of angular core\n\nngResrouce: convenient wrapper around REST API that a server supports CRUD operations.\n\nDEPENDENCY INJECTION: ngResource injection in app.js modules and $resource injection into services.js\nrememeber no $resource injection in controllers.js because controllers.js are injected with our services (menuFactory)\n\n$resource USAGE: ex. $resource( URL. [paramDetails], [actions], options);\n\n$resource default:\n.get() - get\n.save() - post\n.query() - get, isArray: true\n.remove() - delete\n.delete() - delete\n\nex. $scope.dishes = $resrouce( baseURL + \"dishes/:id\", null, {'update' : {method : 'PUT'}} ) .query() ;\n\"A call to the resrouce will return an object of the resource class, so you can acces the methods immediately.\nAlso no need to initialize object in controllers, with $resrouce $scope.dishes by defualt will be empty if nothing\nis added to it.\n\nNotice above is the dishes object. so we query for the entire array. If we wanted to get particular dish in that object,\nwe set dish to .getdishes.get with requested id as follows:\n\n$scope.dish = menuFactory.getDishes().get({id:parseInt($stateParams.id,10)\n\"With this call, I am setting scope.dish to menufac.getdishes, and i use the.get method, with which I supply\nparameter as id: and parse the information I get through my stateParams, and pass that as a parameter to .get()\nGet method will return the psecific dish I asked for.\n\nin indexcontroller we set scope.dish to .get([id:0})\n\nEXERCISE SUMMARY: Used angular ngResrouce module and $resrouce service to acces a Restful API Server","distinct":true,"url":"https://api.github.com/repos/surakhchin/Coursera/commits/787b1a8a5fca47d4f79b06c4530f9d91b4c9345a"}]}
{"actor":{"display_login":"surakhchin"}}