From 50e6bb46adfd8efe83d84bcce5afdb7acdd08b41 Mon Sep 17 00:00:00 2001 From: Rahul Date: Sun, 12 May 2024 17:44:47 +0530 Subject: [PATCH] env in frontend --- frontend/.env.sample | 1 + frontend/.gitignore | 2 ++ frontend/src/App.jsx | 9 +++------ 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 frontend/.env.sample diff --git a/frontend/.env.sample b/frontend/.env.sample new file mode 100644 index 0000000..b8f5336 --- /dev/null +++ b/frontend/.env.sample @@ -0,0 +1 @@ +VITE_BACKEND_URL="" diff --git a/frontend/.gitignore b/frontend/.gitignore index a547bf3..3b0b403 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -22,3 +22,5 @@ dist-ssr *.njsproj *.sln *.sw? + +.env \ No newline at end of file diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 0ea5c8a..4a26757 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -13,12 +13,9 @@ const App = () => { const fetchSongData = async () => { try { - const response = await axios.get( - "https://spring-music-player-3hyj.vercel.app/search", - { - params: { song: searchQuery }, - } - ); + const response = await axios.get(import.meta.env.VITE_BACKEND_URL, { + params: { song: searchQuery }, + }); setData(response.data); } catch (error) { console.error(error);