We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Main

Let's get to work on the actual application! Our program takes as a command line argument the website URL we want to crawl (or at least the page we want to start from)

Remember, you can run the program itself using npm:

npm run start BASE_URL

Where BASE_URL is the root URL of the website we want to crawl. For example: https://learnwebscraping.dev/practice/ecommerce/.

Create a main function and call it.

function main() {
  // ?
}

main();

You will need to process command line arguments for this step.

All your main function should do at this point is:

The number of arguments we pass to npm is not equal to the number of arguments to our CLI.

Test It by Running It

This is a good example of some code that's a bit weird to test with unit tests. Just run the dang thing with too few, just the right amount, and too many arguments to ensure it behaves as expected.

Run and submit the CLI tests from the root of the project.