Skip to content

Commit

Permalink
Add environment variables on front (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
robozmey authored Oct 27, 2023
1 parent 37b591e commit 4572858
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_REST_SERVER_ADDRESS="http://127.0.0.1:8080"
15 changes: 15 additions & 0 deletions client/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# WEB CLIENT for ROOMKN

## Run

`npm run start`

## Build

`npm run build`

Built static files in `./build`

## Environment variables

`REACT_APP_REST_SERVER_ADDRESS`
3 changes: 2 additions & 1 deletion client/src/api/API.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useEffect, useState } from 'react';

const API_HOST = "http://127.0.0.1:8080"
const API_HOST = process.env.REACT_APP_REST_SERVER_ADDRESS

export function useAPI(url, data=null, method='GET') {
console.log(API_HOST)
const [result, setResult] = useState();
const [loading, setLoading] = useState(true);
const [finished, setFinished] = useState(false);
Expand Down

0 comments on commit 4572858

Please sign in to comment.