@Raff
Nothing here yet.
Nothing here yet.
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
HI, the documentation is not too detailed. Could you kindly explain me step by step the meaning of these lines of code?especially this part here: '/api': { target: 'http://localhost:3000/', changeOrigin: true, pathRewrite: { '^/api': '' } } thanks.
Sahil Kazi thanks, one last thing, can you tell me if these considerations are correct? my client app runs on localhost:8080. server api runs on localhost:3000. 1) target option, in the proxy:{}, is the target URL('localhost:3000'), that is the server URL without resource path. 2) /api is first segment of a request path from the client app (for example localhost:8080/api) 3) pathRewrite modifies the matched portion from the target URL, in this case it replaces /api with empty string. ^/api is RegExp that matches the portion path in the target URL. 4) With the above code, every requests starts with /api :(localhost:8080/api, localhost:8080/api/1 ..........) will be proxied to localhost:3000, localhost:3000/1 ........ all correct?