My OSD600 release 0.1

UrlStatusChecker, The first cli I build.

UrlStatusChecker is a command-line tool written in Node.js to check all the URL's status inside your local file. It prints good, bad, unknown, and broken / no response to the console. 

The current version is 0.1. 

Link to the repo: https://github.com/tianlangwu/urlStatusChecker

How to install UrlStatusChecker

Run the command using "npm i -g https://github.com/tianlangwu/urlStatusChecker"






Or download the files from https://github.com/tianlangwu/urlStatusChecker, then "run npm install -g pathName"(e.g., "npm install -g C:\Seneca\OSD600\Release0.1"). After download, you can also "cd" to the path directory then run npm install -g.


How to use UrlStatusChecker


Run the command using "urlstatuschecker Path\filename"
(e.g., 
urlstatuschecker C:\Seneca\OSD600\Release0.1\test1.html).



Optional Features

1. URLs printed in colors depending on their status.

If the URL is good with the status code 200, it prints "GOOD" in green.

If the URL is bad with the status code 400 or 404, it prints "BAD" in Red.

If the URL is redirect to somewhere with the status code 301, 307, 308, it prints "Redirect" in Blue.

If the URL is broken or no response, it prints "Broken / No response" in White.


2. Support command line args.

-v / -version /v /version will show the Current version of urlStatusChecker. 


-u: Check the URL status directly(e.g., "urlstatuschecker -u http://www.google.com").



3. Support redirect HTTP result codes(301, 307, 308).

4. Allow passing multiple file paths


The language I use and the problem I got

I am using node.js to do my release 0.1 because I feel that "npm" and npm packages can make my project easier. However, this release 0.1 still took me a quite long time to finish. The main reason I got stuck is that I don't know how to find the URL in a text. I am so dumb that I didn't notice regular expression can solve this problem easily. I was trying to use the indexOf() function to find the first index of "http" and the next index of the quotation mark. This can only work for some html files because URLs in the html file usually has a quotation mark at the end of the URL. Philip from slack reminds me that I can try regex for the problem. Therefore, I googled a URL regex, and use match() function to get them into an array.

The third-party Package I use

I used three third-party Package which is "chalk", "sync-request" and "optimits". I use chalk to change the color of the output console, "sync-request" to send the synchronized request, and "optimist" to accomplish the command line arguments. 


Comments

Popular posts from this blog

My PR for release 0.3 External Project

OSD600 Lab8

OSD600 -- Release 0.4.1 -- Choose Project and issues