8/27/18 CS314 Software Engineering RESTful Services Dave Matthews Sprint 1 Architecture 1
8/27/18 JSON - JavaScript Object Notation www.json.org • Lightweight data interchange format • text format that is language independent • built on two structures – name/value pairs (object) – ordered list (array) JSON - JavaScript Object Notation JSON to string string to JSON var var obj obj = { = { var var str str = ' = '{ { "title":"text title":"text", ", "title":"text title":"text", ", "values":[1,2,3,4,5,6] "values":[1,2,3,4,5,6] "values":[1,2,3,4,5,6] "values":[1,2,3,4,5,6] }; }; }'; '; var str var str = = var var obj obj = = JSON.parse JSON.parse(str str); ); JSON.stringify(obj JSON.stringify obj); ); 2
8/27/18 Trip Format For Interchange (TFFI) { "type type" : "config config", "version version" : 1, "units units" : ["miles"] ["miles"] } Trip Format For Interchange (TFFI) { "type type" : "distance distance", "version version" : 1, "origin origin" : {"latitude":40.5854, {"latitude":40.5854, "longitude": "longitude":-105.0844}, 105.0844}, "destination": {"latitude":-33.8688, "destination": {"latitude": 33.8688, "longitude":151.2093}, "longitude":151.2093}, "units":"miles units":"miles", ", "distance":0 "distance":0 } 3
8/27/18 Web Environment Code Review - /config • Client send request – client/src/components/Application/Application.js – client/src/api/api.js • Server RESTful API request handling – server/src/main/java/com.tripco.t00.server/MicroServer.java • Server JSON/Gson request and response conversions – server/src/main/java/com.tripco.t00.server/Config.java • Client response handling – client/src/components/Application/Application.js 4
Recommend
More recommend