Skip to content

feat: add BackendURL component and improve env variable handling #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/front/components/BackendURL.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ export const BackendURL = () => (
<li>Make sure you backend is running on port 3001.</li>
<li>Open your API and copy the API host.</li>
<li>Open the .env file (do not open the .env.example)</li>
<<<<<<< HEAD
<li>Add a new variable VITE_BACKEND_URL=<Dark>your api host</Dark></li>
<li>Replace <Dark>your api host</Dark> with the public API URL of your flask backend sever running at port 3001</li>
</ol>
<div className="w-100">
<img src={envFile} className="w-100"/>
</div>
=======
<li>Add a new variable BACKEND_URL=<Dark>your api host</Dark></li>
<li>Replace <Dark>your api host</Dark> with the public API URL of your flask backend sever running at port 3001</li>
</ol>
<img src={envFile} />
>>>>>>> 6b119bd (feat: add BackendURL component and improve env variable handling)
<p>Note: If you are publishing your website to Heroku, Render.com or any other hosting you probably need to follow other steps.</p>
</div>
);
4 changes: 4 additions & 0 deletions src/front/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
export const Footer = () => (
<footer className="footer mt-auto py-3 text-center">
<p>
<<<<<<< HEAD
Check the <a target="_blank" href="https://4geeks.com/docs/start/react-flask-template">template documentation</a> <i className="fa-solid fa-file"></i> for help.
=======
Check the <a target="_blank" href="https://4geeks.com/docs/start/start-react-advanced-project">template documentation</a> <i className="fa-solid fa-file"></i> for help.
>>>>>>> 6b119bd (feat: add BackendURL component and improve env variable handling)
</p>
<p>
Made with <i className="fa fa-heart text-danger" /> by{" "}
Expand Down
4 changes: 4 additions & 0 deletions src/front/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { StoreProvider } from './hooks/useGlobalReducer'; // Import the StorePr
import { BackendURL } from './components/BackendURL';

const Main = () => {
<<<<<<< HEAD
=======
console.log(import.meta.env.VITE_BACKEND_URL);
>>>>>>> 6b119bd (feat: add BackendURL component and improve env variable handling)

if(! import.meta.env.VITE_BACKEND_URL || import.meta.env.VITE_BACKEND_URL == "") return (
<React.StrictMode>
Expand Down