Application Configuration
Targetting staging/production API
Via environment variable
Providing API_ENV environment variable determines which API endpoints will be hit:
# Hit staging
API_ENV=staging pnpm dev
# Hit production
API_ENV=production pnpm dev
Via config route
In addition, visiting the /api/config path on localhost or staging will make all API calls hit certain production/staging endpoints (you may need to refresh the page).
/api/config?apiEnv=staging/api/config?apiEnv=production/api/config?apiEnv=production&trip=api.trp.staging-traveloka.com— override "trip" API endpoint/api/config?apiEnv=production&trip=api.trp.staging-traveloka.com&user=api.usr.staging-traveloka.com— override multiple endpoints/api/config?apiEnv=production&trip=— clear "trip" endpoint/api/config?clear— clear all configuration
Curling API calls
info
You can configure how our app (hitting staging/production API) runs by making some configuration changes.
On root, set the following environment variables to have api-proxy log all API calls. To test/debug these curl commands, you should manually remove the -H 'Accept-Encoding: br, gzip' to see the uncompressed response.
Also note that CURL_URL_REGEX is optional.
export CURL=true
export CURL_URL_REGEX="data(.*)/events/"
pnpm dev