DEV Community

loading...

FireLinker + TeleScope

zg3d profile image Devansh Shah Updated on ・2 min read

What is this Blog About?

This week, I used my Open Source project FireLinker to interact with Telescope.Last week, I wrote a blog about my first contribution to telescope in that blog I already had setup telescope on my local machine and I also talked about working with it more in the future. So, here we are I am using my FireLinker to check links in the posts API for telescope.

previous blog about telescope with setup: https://dev.to/zg3d/telescope-my-first-contribution-19en

API How does it work?

The way the posts API works is every time you go to /posts on the backend server you get a JSON of the 10 latest post with a relative URL and post id.

How did I connect FireLinker and Telescope?

I made a new command for my FireLinker So it can interact with APIs. I tried to generalize it but my goal was to connect with the telescope API. So, I did make some assumptions like I knew it was a relative path, so I found the base URL and added it. I also made an assumption that there was a attribute for URL in the API. But with those assumptions I got it working on my local machine. FireLinker basically uses the given API URL and fetch it with a get request and from there the code parses the JSON and checks on the URL links.

What are my Thoughts?

This was a very quick and dirty way of doing things. I still need to add check to see id the API URL is valid and proper error code messaging. This was a simple thing to do as I am comfortable with working with API like rest. And this was a basic API.

Update

So, I also made it so that FireLinker check all links in the 10 recent posts. Which made my code more modular and now I am happy with the state of my code.

Discussion (0)

pic
Editor guide