Update: Take a API from telescope API for findbrokenURL
Published: 2020-11-07 20:37:35

###Before start

[telescope](https://github.com/Seneca-CDOT/telescope) is an amazing web project in Seneca. Telescope is an open source web server and client application for aggregating and presenting a timeline of Seneca's open source blogs. Telescope makes it easy to see what's happening with open source at Seneca right now.

##Installation
To run the telescope, we need [docker, redis and elasticsearch](https://github.com/Seneca-CDOT/telescope/blob/master/docs/environment-setup.md). As I am a window 10 home user, I needed to install [WSL2](https://docs.microsoft.com/en-us/windows/wsl/compare-versions)-Ubuntu on my machine. 

After install WSL2, go to the docker website and install the [docker desktop app](https://docs.docker.com/docker-for-windows/wsl-tech-preview/). After all installing all the prerequisites, we are ready to go.

###Issues
However, after installing everything by following the step, you might come across some very buggy issues. One is you may not be able to run the docker as a background running `sudo systemctl start docker` on your subsystem. If you spent some time to figure it out, you might try this `alias systemctl='/etc/init.d/docker `, if it fails, that means you don't have /etc/init.d/ file on your subsytem. 
As far as I know, if you are in this stage, you would have 2 options. 

1. Just use desktop app, you can simply turn off and on using with desktop app(GUI), actually no need to use CLI "AT ALL."

2. Install the docker engine -Linux version- again. This may anyhow create init.d files on your subsystem, so you probably would be able to use the above command. 

I chose the first option.

"_Do I use Window for development? : hell NO_"
-- <font size="0.1em"> telescope community</font> --

##Running Telescope
If you don't have issues or solved them already, CONGRATULATION! you are "really" good to go. 

First you need to install redis and elasticsearch on your system. With docker, this can be managed automatically. To install and run the multiple images and make them containers you can simply do this `docker-compose up --build redis elasticsearch`. 

After that, you can find that you are running redis and elasticsearch is running. Then you can `npm start` to run the backend server.

##Update: enable to take `.json` from telescope API
I added one more option which is --api/-a. With this option user can pass a certain host+apiURL to communicate with them.

changes
```
if (arg.a) {
  console.log(chalk.bgBlueBright("*******API Request start*******"))
  axios
    .get(arg.a)
    .then(async (response) => {
      console.log(chalk.bgGreenBright("*******API Request Success*******"))
      if (arg.j) {
        response.data.map(res=>{
          await jsonFetch(path.resolve(arg.a, `./${res[id]}`));
        })
      } else {
        response.data.map(res=>{
          await fetchFunction(path.resolve(arg.a, `./${res[id]}`), arg.a);
        })
      }
    })
    .catch((error) => {
      console.log(chalk.bgRedBright("*******API Request Fails*******"))
      console.log(
        chalk.yellowBright(
          `Cannot found: ${arg.a}. Probably because of network connection problem or wrong API address`
        )
      );
    });
} else 
```

Now, this tool can be used for any api if the api has json format URL.

__[find more info](https://gist.github.com/klee214/81c3906a0b1fa138902bfdbd0e035efa)__