Create a job queue that collects site html and persists it to a database when given a URL.
- Run
npm install
from the root directory. - Rename
example.env
to.env
. Use the.env
file to enter in your redis server ip address and port. - Open 2 terminals in the root directory, execute
node apiServer.js
in one andnode serviceWorker.js
in the other. - Make a
POST
http request to the root,/
, endpoint (should behttp://127.0.0.1:3000
unless you changed the port) and provide aurl
in the body. (Ex.{url: 'http://www.google.com'}
). - A
job_id
will be in the return payload that you can then use to make aGET
request to the root/
endpoint and retrieve the URL's HTML content. Thejob_id
must be submitted as a query string. (Ex. http://127.0.0.1:3000?job_id=1234).