homework | javascript | oop代写 | html代写 | 代做assignment – CS602 Module2 Assignment

CS602 Module2 Assignment

homework | javascript | oop代写 | html代写 | 代做assignment – 这道题目是利用js进行的编程代写任务, 包括了javascript/oop/html等方面, 这个项目是assignment代写的代写题目

homework代写 代写homework hw代做

 2021 , Suresh Kalathur, All Rights Reserved.
The following document should not be disseminated outside the purview of its intended purpose.

General Rules for homework Assignments

  • You are strongly encouraged to add comments throughout the program. Doing so will help your instructor to understand your programming logic and grade you more accurately.
  • You must work on your assignments individually. You are not allowed to copy the answers from the others.
  • Each assignment has a strict deadline. Assignments submitted after the deadline will have a penalty.
  • When the term lastName is referenced in an assignment, please replace it with your last name.

Download and extract the starter template zip file, CS602_HW2_ lastName. Rename the folder with your last name. Complete the corresponding javascript and View files in this folder.

Part 1 net Module (25 Points)

Use the subfolder part1 and complete the following files. Copy the zipCodeModule_v2.js from Module1 assignment. Complete the server

application (server/server.js) and the client application (client/client.js)

using the net module. The clients communicate with the server using the following commands:

  • lookupByZipCode,
  • lookupByCityState,,
  • getPopulationByState,

The server application listens for client connections and when the client command is received, processes the request by invoking the corresponding

function available through the zipCodeModule. The server then uses

JSON.stringify to send the result back to the client.

The client application reads commands from the users console in a l oop and sends the commands to the server. When the data is received back from the server, the corresponding result is printed to the console.

Test the application with the server running in one window, and a client running in a separate window.

The sample output of the server and the client application is shown below. You can optionally use the colors module for colors in the output.

Part 2 Express, Handlebars & REST Endpoints

(7 5 Points)

Use the subfolder part2 and complete the following files. Copy the

zipCodeModule_v2.js from Module1 assignment. Complete the Express

server application (server.js) and the corresponding views to do the following:

  • GET request / Render the home view with a welcome message.
  • GET request /zip If the request query id parameter is present, lookup the corresponding data and render the lookupByZipView. Otherwise, render the lookupByZipForm.
  • POST request /zip Lookup the corresponding data for the request body id parameter and render the lookupByZipView.
  • GET request /zip/:id Should be capable of handling json, xml, and html requests. Use the named routing id parameter and lookup the corresponding data. For html request, render the lookupByZipView.
  • GET request /city If the request query city parameter and state parameter are present, lookup the corresponding data and render the lookupByCityStateView. Otherwise, render the lookupByCityStateForm.
  • POST request /city Lookup the corresponding data for the request body state and city parameters and render the lookupByCityStateView.
  • GET request /city/:city/state/:state Should be capable of handling json, xml, and html requests. Use the named routing city and state parameters and lookup the corresponding data. For html request, render the lookupByCityStateView.
  • GET request /pop If the request query state parameter is present, lookup the corresponding data and render the populationView. Otherwise, render the PopulationForm.
  • GET request /pop/:state Should be capable of handling json, xml, and html requests Use the named routing state parameter and lookup the corresponding data. For html request, render the populationView.
TESTING THE APPLICATION (BROWSER)

Test the application for html requests using the browser. The default home page can be as shown below.

Click the Lookup By ZipCode link. The following form is displayed to the user.

If the user enters, say 02215 for ZipCode and clicks the Submit button, the above form is submitted with the POST request. The resulting view is as shown below:

If the user types the direct URL as shown below, the resulting view is as below:

Click the Lookup By City,State link. The following form is displayed to the user.

If the user enters, say BOSTON for City , MA for State, and clicks the Submit button, the above form is submitted with the POST request. The resulting view is as shown below:

If the user clicks on a particular zip code in the above view, the result is processed with a GET request as shown below.

In the above view, if the user clicks the last link, the result is processed with a GET request as shown below.

If the user types the direct URL as shown below, the resulting view is as below:

Click the Get State Population link. The following page is displayed to the user.

If the user clicks on a state, say MA, in the above view, the result is processed with a GET request as shown below:

If the user types the direct URL as shown below, the resulting view is as below:

TESTING THE APPLICATION (REST Endpoints)

The REST endpoints for JSON and XML data can be tested with curl or Postman.

The curl outputs are shown below (If curl is not installed, see https://curl.haxx.se/download.html)

Test the application for the JSON GET requests as shown below.

Similarly, test the application for the XML GET requests as shown below.

The Postman outputs for JSON GET requests are shown below.

(For installation of Postman: https://www.postman.com/downloads/)

The Postman outputs for XML GET requests are shown below.

Submission: Export your CS602_HW 2 _ lastName folder

containing all the relevant files as a zip file, and upload the zip

file to the Assignment section.