localhost serves up
app.js can’t make HTTP requests of any server except
localhost. Some servers whitelist domains, allowing them to make such cross-origin requests, but many don’t.
One way of dealing with this involves a “reverse proxy" — that is, forwarding requests through your backend to the database, where you hit a particular endpoint for your backend, and the backend just passes the same request along to the database. Here’s how to do it in Express, using request: