DEV Community

Phan Hieu Nguyen
Phan Hieu Nguyen

Posted on

Integrate my CLI with another project

Summary

I modified my CLI so it can be (kind of) integrated with Seneca Telescope.
Repo link
Gist diff

Challenges

The first challenges is setting up the project. I believe I mentioned this in one of my previous blog. So in short, I had some problems setting it up. But if I know that all I need was Node.js and Docker, it should be fine. Setting up to work with REST API is in contrast, simple enough.
So majority of the work is adding functionality to my CLI so it can work with this project. The steps as follow:

  • Send GET request query to Telescope backend to receive initial data. A simple and straight forward code.
  • Convert the request result to JSON object so we can use it later.
  • Loop through each link the JSON object to send GET request to receive HTML page source code.
  • Append HTML results in to a big HTML file.
  • The CLI can read HTML file like it was originally built for.
  • Clean up the file afterward I don't get much problems with the works. The only thing I remember was JSON object works a little bit different from JS objects.

Top comments (0)