Updated some things in the frontend
- App zeigt nun eine Zeit an, wenn backend zur verfügung steht - Docker-Port ist auf 3000, weil Standard
This commit is contained in:
parent
8fd0e44422
commit
18e6420500
2 changed files with 20 additions and 8 deletions
|
@ -10,6 +10,6 @@ services:
|
|||
- '.:/app:z'
|
||||
- '/app/node_modules'
|
||||
ports:
|
||||
- 3001:3000
|
||||
- 3000:3000
|
||||
environment:
|
||||
- CHOKIDAR_USEPOLLING=true
|
||||
|
|
|
@ -1,13 +1,25 @@
|
|||
import React from 'react';
|
||||
import HelloWorld from './HelloWorld';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div classname="App">
|
||||
<HelloWorld />
|
||||
</div>
|
||||
);
|
||||
const [currentTime, setCurrentTime] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/time').then(res => res.json()).then(data => {
|
||||
setCurrentTime(data.time);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
|
||||
|
||||
<p>The current time is {currentTime}.</p>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
Loading…
Reference in a new issue