Commit 5e04b377 authored by Bianca-Mihaela Ganescu's avatar Bianca-Mihaela Ganescu
Browse files

added dummy backend to connect to frontend [BG, IK]

parent e9886a10
Pipeline #198852 passed with stages
in 4 minutes and 8 seconds
FLASK_APP=api.py
FLASK_ENV=development
\ No newline at end of file
import time
from flask import Flask
app = Flask(__name__)
@app.route('/time')
def get_current_time():
return {'time': time.time()}
\ No newline at end of file
......@@ -18,6 +18,7 @@
},
"scripts": {
"start": "react-scripts start",
"start-api": "cd api && venv/bin/flask run --no-debugger",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
......@@ -39,5 +40,6 @@
"last 1 firefox version",
"last 1 safari version"
]
}
},
"proxy": "http://localhost:5000"
}
......@@ -10,6 +10,13 @@ const Home = () => {
setCount(count + 1)
// open a new page where one can add a new project
}
const [currentTime, setCurrentTime] = useState(0);
useEffect(() => {
fetch('/time').then(res => res.json()).then(data => {
setCurrentTime(data.time);
});
}, []);
return (
<div className="home">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment