When integrating a project folder with Quasar CLI and the Main Starter Kit with an existing backend, a common need is to access the backend API when using the dev server. To achieve this, we can run the dev server and the API backend side-by-side (or remotely), and let the dev server proxy all API requests to the actual backend.
This is useful if you access relative paths in your API requests. Obviously, these relative paths will probably not work while you are developing. In order to create an environment similar to the one used by your deployed website/app, you can proxy your API requests.
To configure the proxy rules, edit
devServer.proxy. You should refer to Webpack Dev Server Proxy docs for detailed usage. But here’s a simple example:
// proxy all requests starting with /api to jsonplaceholder
The above example will proxy the request