chore: Updated server env
543c7581
2 file(s) · +3 −2
| 1 | - | ``` |
|
| 2 | 1 | # bhvr/.gitignore |
|
| 3 | 2 | # dependencies |
|
| 4 | 3 | node_modules |
| 3 | 3 | import { ApiResponse } from 'shared' |
|
| 4 | 4 | import './App.css' |
|
| 5 | 5 | ||
| 6 | + | const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000" |
|
| 7 | + | ||
| 6 | 8 | function App() { |
|
| 7 | 9 | const [data, setData] = useState<ApiResponse | undefined>() |
|
| 8 | 10 | ||
| 9 | 11 | async function sendRequest() { |
|
| 10 | 12 | try { |
|
| 11 | - | const req = await fetch(`${import.meta.env.VITE_SERVER_URL}/hello`) |
|
| 13 | + | const req = await fetch(`${SERVER_URL}/hello`) |
|
| 12 | 14 | const res: ApiResponse = await req.json() |
|
| 13 | 15 | setData(res) |
|
| 14 | 16 | } catch (error) { |