Commit 9bdc9105 authored by Christian Wander's avatar Christian Wander
Browse files

adding a web frontend

parent a219b691
......@@ -5,6 +5,7 @@ import pixelframe.pixel_service as pixel_service
def main_page():
return render_template('main.html')
return "This is the main page"
......@@ -12,12 +13,12 @@ def main_page():
def hello_method():
return render_template('hello.html', name="foo")
@app.route('/start', methods=["POST"])
def start_pixels():
return "Started work."
@app.route('/stop', methods=["POST"])
def stop_pixels():
return "Stopped work"
body {
background-color: black;
font-family: 'Courier New', Courier, monospace;
h1 {
color: pink;
\ No newline at end of file
document.getElementById("buttonOne").onclick = function() {
console.log("button one clicked")
fetch('start', { method: 'POST'})
.then(r => {
console.log(`Status: ${r.status}, text: ${r.statusText}`)
document.getElementById("buttonTwo").onclick = function() {
console.log("button two clicked")
fetch('stop', { method: 'POST'})
.then(r => {
console.log(`Status: ${r.status}, text: ${r.statusText}`)
\ No newline at end of file
<!doctype html>
<link rel="stylesheet" href="static/main.css" />
<p>This is some text and even more text</p>
{% if name %}
<p>Hello {{ name }}!</p>
{% else %}
<p>Hello, World!</p>
{% endif %}
<button type="button" id="buttonOne">Start</button>
<button type="button" id="buttonTwo">Stop</button>
<script src="static/main.js"></script>
\ No newline at end of file
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