Week2 Webpage status checking tool

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 for it. 







Comments

Popular posts from this blog

Week3Lab2

Week2 Lab1

week4lab3