ALAO LAWAL ADECHINA thanks for the answer.
Tell me if I understand correctly:
1)
'/api': { target: 'localhost:3000' ........ }
All requests made to /api' from within my vue application will be forwarded to target: 'localhost:3000'
So if I have my client (vue app) runs at localhost:8080 and there are requests that start with resource path /api, these requests will be proxied to the target address: localhost:3000
for example:
request localhost:8080/api will be proxied to localhost:3000/api
request localhost:8080/api/1 will be proxied to localhost:3000/api/1 and so on.
.........................................................................................................
2) pathRewrite: { '^/api': '' }
^/api is a regex.
pathRewrite matches /api path segment in the target address and replaces it (/api) with empty string
for example proxied request to localhost:3000/api/1 will become localhost:3000/1
all correct or are there errors?
Thanks
ALAO LAWAL ADECHINA
Entrepreneur - Software Engineer- Instructor
cli.vuejs.org/config check this.. it should help you