This example demonstrates a user case whereby the app proxies all urls that start with /api
to
http://jsonplaceholder.typicode.com/
, but removes /api
from the url. So
http://localhost:8080/api/users
should perform a request to
http://jsonplaceholder.typicode.com/users
.
npx webpack serve --open
- The script should open
http://localhost:8080/
in your default browser. - You should see the text on the page itself change to read
Success!
. - Navigate to
http://localhost:8080/api/users
. - The page should display several JSON objects.
- Navigate to
http://localhost:8080/api/nope
. - The page should display `Bypassed proxy!``.