From 5df4bf8aed2036eb928b0ab81092dcad34acd94f Mon Sep 17 00:00:00 2001 From: avinmaster Date: Wed, 22 Dec 2021 22:32:05 +0500 Subject: [PATCH] Getting API URL from .env file --- .env.example | 1 + .gitignore | 1 + README.md | 5 ++++- src/App.vue | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..de87617 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +VUE_APP_API_URL= \ No newline at end of file diff --git a/.gitignore b/.gitignore index 403adbc..6c976e9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ node_modules # local env files .env.local .env.*.local +.env # Log files npm-debug.log* diff --git a/README.md b/README.md index f34ee71..e6a987b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,10 @@ ``` yarn install ``` - +Then, create a new `.env` file and specify the address for your API there. For example: +``` +VUE_APP_API_URL=house-search.com/api +``` ### Compiles and hot-reloads for development ``` yarn serve diff --git a/src/App.vue b/src/App.vue index e43bd8b..16ff001 100644 --- a/src/App.vue +++ b/src/App.vue @@ -68,7 +68,7 @@ export default { submit() { this.loading = true; axios - .post(`http://house-search.com/api/v1.0.0/search`, { + .post(`http://${process.env.VUE_APP_API_URL}/v1.0.0/search`, { name: this.name, minPrice: this.minPrice, maxPrice: this.maxPrice,