Posts

week4lab3

Image
 From this week's lab I learn how to create a branch, merge the branch and puch it to the master branch.  In this week lab I added two features to my current app, print out the with json format and only print out those websites with bad or good status.  The first part is for --bad and --good command. In this part, I use for loop instead of foreach() function, because we need to decide if we got any --bad or --good command passed in to the program. Secondly, for  the print out json format part. I crate a new variable resultList to store all the result. Each time the foreach() function get called, it will push the result into the resultList. At the end we just need to print out the resultList then we are all good. By the way we can also commit our code from the VS code editer, at the left hand side. we can directly see what files have been changed.

Week3Lab2

Image
 Our lab 2 is about collaborating with other people by creating pull requests.  I choose the project from Sanjida Afrin, because she also using node.js for her project. By reviewing her code, I can also learn from her at the same time. So in her project, she was using "yargs" for the command options. This is a good tool to simplify the code for the command options. However, this library doesn't suport the command options other than the command options that start with "--" or "-". So I updated it to make it work. I also add some code to check the HTTP response status for 301, 307 and 308 just in case she may use it in the future. This also help me review the properties of the HTTP header. I found that pull request is very useful. This protects the author's original code from being changed, but allows people to change it at will. If the author thinks the changes are good, he can merge the changes directly to update his code.

Week2 Lab1

Image
The lab 2 is review and test other's project. To be honest, I am not a person who had good interpersonal skills. However, after I finally have a chance log in to Slack, I find the people in the community very nice and very supportive of one another. The project I review is from Alexander Hugh, since his project is using JavaScript and Node.js too, maybe I can help him improve his code. In his code, everything was working perfectly , but I think there is room for improvement. He create different array to store the data, then loop through the array one by one. In my opinion, I think he could just use the build in function foreach() to loop through every element in the array. This will make the code look cleaner and simpler. From reviewing other's code, I can also learn from them. Such as I don't have the color printing yet, and I find they use a dependency call "chalk" to achieve it. This lab really helps me alot.

Week2 Webpage status checking tool

Image
Overview  This week we need to create a command-line tool for finding and reporting dead links. Basically it's like ping a website and see if it will respond, but base on what HTTP status code we received, we can know if the website current state is good or not.  I choose to use Nodejs to do it because I want to practice thing related in web and become a web developer in future.  Intorduction First, install npm if you don't have it installed. Then onpen the project with VS code. Enter command "node checkURLs.js xxx", xxx is the filename you want to check. Enter command "node checkURLs.js --v" to check current version. (I think there will be more features in the future.) This code first compare the command it recived with predefine command. Then check if the file exist. Send GET request wo each URL. Here is part of the output. I don't have the color printing yet, maybe there's a library that can implement the functionality I need, but I need to search...