I found this amazing MEVN stack tutorial that I've been following:
The tutorial is about creating a blog post app, where the client side is built using Vue (referred to as app A) and the backend is built on Express.js providing data from MongoDB through a JSON Rest API (referred to as app B). However, it uses the cors package in app B to allow cross-origin requests, which poses a security risk by allowing third-party access to its APIs directly.
I'm looking for a way to eliminate the need for CORS in app B. One solution could be to have app A's frontend JavaScript not make calls directly to app B, but instead call app A's backend, which then makes the necessary calls to app B after validating the request parameters. But how would I go about implementing this, especially since the express-based app.js file in app A exists within the Vue directory structure?
Currently, I'm using axios for HTTP requests in app A and I'm unsure of how to use it to solve the CORS problem mentioned above.