From 94016c74327e410dbc1417b5569e45ba10f1d5d6 Mon Sep 17 00:00:00 2001 From: nannal Date: Wed, 9 Dec 2020 21:03:09 +0200 Subject: [PATCH] weird behaviour with send testing in docker --- Private/nginx.conf | 4 ++-- Public/index.html | 26 +++++++++++------------ Public/script.js | 33 ++++++++++++++++-------------- Public/style.css | 51 ---------------------------------------------- 4 files changed, 32 insertions(+), 82 deletions(-) delete mode 100644 Public/style.css diff --git a/Private/nginx.conf b/Private/nginx.conf index 3eb0f2f..5837b07 100644 --- a/Private/nginx.conf +++ b/Private/nginx.conf @@ -9,8 +9,8 @@ http { include /etc/nginx/mime.types; server { - location /wave { - proxy_pass http://10.0.0.205:5000; + location /submit { + proxy_pass http://10.0.0.200:9000/submit; } location / { root /usr/share/nginx/html; diff --git a/Public/index.html b/Public/index.html index 477a98a..6b4f73e 100644 --- a/Public/index.html +++ b/Public/index.html @@ -1,22 +1,20 @@ - Flag Waver - - + 🚂Vote Train🚂 + - -
- -
- -
- -
- -
- + +
+
+
+
+ Upvote:
+ Downvote:
+ +
+
diff --git a/Public/script.js b/Public/script.js index 9d11d18..eb524d9 100644 --- a/Public/script.js +++ b/Public/script.js @@ -1,18 +1,21 @@ -function runVid(){ - if (flvjs.isSupported()) { - var videoElement = document.getElementById('videoElement'); - var flvPlayer = flvjs.createPlayer({ - type: 'flv', - url: 'https://stream.nannal.com/live/flag.flv' - }); - flvPlayer.attachMediaElement(videoElement); - flvPlayer.load(); - flvPlayer.play(); - var vid = document.getElementById("videoElement") - vid.style.display = "block"; +function send(){ + + data={ + key:document.getElementById("key").value, + upvote: document.getElementById("upvote").checked, + downvote:document.getElementById("downvote").checked, + } -} + let response = await fetch('http://localhost:9000/submit', { + method: 'POST', + headers: { + 'Content-Type': 'application/json;charset=utf-8' + }, + body: JSON.stringify(data) + }); + + let result = await response.json(); + document.getElementById("input").innerHTML= result.message + -function wave(){ - let promise = fetch('/wave') } diff --git a/Public/style.css b/Public/style.css deleted file mode 100644 index 9a5848e..0000000 --- a/Public/style.css +++ /dev/null @@ -1,51 +0,0 @@ -body { - text-align: center; -} - -.button-wrapper{ - text-align: center; - margin: 10px; -} - -#wave { - background-color: #f44336; - border: none; - color: white; - padding: 15px 32px; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; - cursor: pointer; - border: none; - border-radius: 15px; - box-shadow: 0 9px #999; -} - -#wave:active { - background-color: red; - box-shadow: 0 5px #666; - transform: translateY(4px); -} - -.video-wrapper{ - margin: auto; - padding: 20px; - width: 50%; -} - -#videoElement { - width:80%; - display: block; -} - -#start-cam { - background-color: grey; - border: none; - color: white; - padding: 15px 32px; - text-align: center; - text-decoration: none; - display: inline; - cursor: pointer; -}