Saturday, November 7, 2020

Lab 6

 Hey PC readers,


Welcome back to my blog!

This week was after the study week and finally no more labs and PR every week. Phew! 

Guess what! I had more  6-7 PRs and I completed Hacktoberfest! woohoo :D


Okay back to this week, I got too excited for Hacktoberfest completion. So this week was something new again. We talked about Telescope, I read on Slack and joined its channel for more info too. But never really worked on it. So this week, we had to do its setup and do a mini task with it. Well, not so mini, but yeah mini according to Telescope code lines. The setup was confusing at first, I got scared really when I read it the first time. There were so many technologies I never heard of. I read and closed it, whew, lots of readings to do first. But then fews days later, I opened it up again. Things made more sense this time. I started doing exactly what was told in the steps, WSL made the life easier. The setup was done, although I did came across an issue, here in the screenshot below it says to run the first command  sudo systemctl start docker

 but that command was not working. I read a few blogs of the students who did it already and figured that doing the second command straight would do it. I did that and it worked. That was really helpful!

 

Alright, rest everything worked fine. And I ran the Telescope server, it worked perfectly. I got my ten posts with its id and url on my 3000 port.

 

Now all I had to do was to use my Link checker to get these urls instead of the ones I provided in the test.txt file that I gave manually.

I started and looked at my code, and realized that my code indeed was in good state and manageable that I did not have to make a lot of changes. The code was modularized too, so I didnt have to edit a lot of existing code. I created a new js file called restHandler where I added the code to  receive these posts by using an endpoint which was 

http://localhost:3000/posts

We would get our 10 posts from here and then I would save them to a new file called postsUrl.txt. The posts list was in Json format so I had to use JSON.stringify in order to use it in my file. I used axios for the fetching previously in my code and in this lab too. I did not make any changes to my fileHandler.js which was handling most of the previous labs code like clicolor, links status, status codes etc. All I added was the new option with 

.option('-e, --endpoint <url>''URL to fetch post list');

My code was up and running. The gist can be found here for my code : https://gist.github.com/chawlapalak/15d026b30c8dd4801e714669f6566183

 

See you in my next blog!

Best regards,

PC

No comments:

Post a Comment

Lab 9 - The last chronicle

 Hey PC readers,  Welcome back to my channel! As the name says, this is our last lab of this semester Lab 9. In the last tale of the lighten...