CpS 404 Internet App Development

Lab 1: Node.js Orientation

Objectives

  • Learn to create and debug Node.js applications
  • Learn to install and use third party Node.js modules

Prerequisites

  • Install the software specified on the Course Software page.
  • Read Chapter 2 of Pro Node.js for Developers (see Resources) through p. 15.

Instructions

  1. Work through this tutorial on VSCode and Node.js. You are welcome to use your preferred editor instead of VSCode.

  2. Create a folder named lab1 on your computer. Open the folder in VS Code. Copy the readfile_sync.js sample program from the class examples into that folder and review the code. Use the node command to run it. Provide the filename of a text file as a command line argument; it should display the contents of the file.

  3. The City of Dallas provides a web service that allows you to retrieve a list of the city council voting records:

    https://www.dallasopendata.com/resource/ts5d-gdq6

    Download the data set via this URL:

    https://www.dallasopendata.com/resource/ts5d-gdq6.csv

    Review the data in a text editor. As is typical in a comma-delimited data file, the first row contains field names.

  4. Read about the Node.js module csv-string. It parses comma-delimited files. It is not a part of the core Node.js library; you must use the npm command to install it into your lab1 folder (see the Installation section of the csv-string documentation). When you install it, a node_modules folder should be created in your lab1 folder, and you should see the csv-string module inside. (You can ignore npm warnings about a missing package.json file.)

  5. Rename readfile_sync.js to lab1.js. Add a require statement to the top to import the module (review the module documentation for an example if you need help). Alter the program so that it displays a list of all of the values in the date, voter_name and vote fields for those records where the agenda_item_number value is ‘1’. Use the parse() function in the csv-string module to assist with parsing the data. The output should be formatted as follows:

     2020-11-17 - Jaime Resendez - YES
     2020-11-17 - Adam Medrano - NO
    

Submission

Using a word processor, write a brief lab report indicating what you completed successfully, as well as what (if anything) isn’t working properly. Include a screen shot of the output of your program and a listing of your program. 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.