It's important to understand the big piocture of what we are trying to do with this. The diagram below shows the path http requests come in from the browser when trying to get data from the web app. If we don't understand this overall path and what we are trying to achieve, we risk getting stuck cargo coding bits and pieces from various tutorials and don't really know how to fix issues/keep up to date.
Before getting into this, make sure you completely understand this https://flaviocopes.com/http-request/