Read about debugging Node.js programs in Visual Studio Code. Then, set a breakpoint, choose Run > Start Debugging, pick Node.js from the list of options, and use the Visual Studio Code debugger to step through your lab1.js program, inspect variable values, etc. 2 points.
Save your lab1.js program as lab2http.js. Then, redesign the program so that it downloads the Dallas City Council data set, uses the CSV module to parse it, and displays the same output as lab1.
Use the http.get() method to download the data (see the http_request.js example we went over in class). No error handling is needed. 2 points.
Locate the request module on npmjs.org and read about how to use it. Install it using npm, and create a second version of your program named lab2request.js that uses the request module instead of the http module to download the data. Handle errors gracefully. Perform the following error handling tests and document the results in the lab report:
3 points.
Create a third version of your program named lab2mydownload.js. In this version, you are to define a function
function download(url, callback)
This asynchronous function should use the http.get() method to download data from the indicated url and pass the downloaded data to the callback function. The function should check the response.statusCode, and if it is not 200, report an error to the callback using code like this:
callback(new Error("Received response code: " + response.statusCode))
The function should also detect and report failures to connect, etc., to the callback. Perform the error scenario tests from step 3 above to verify that all of this error handling works correctly, and document these tests carefully in the report.
Rewrite the main program to use your download() function. 3 points.
Write a brief lab report indicating what you completed successfully, as well as what (if anything) isn’t working properly. Include screen shots showing the debugger in action (step 1), the output of your programs and results of error tests, and source code listings.
Your report should start with a cover sheet with your name, the assignment title, date, course number. Generate a pdf named report.pdf, and submit via Canvas.