-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function encodeBase64(input) | ||
{ | ||
const utf8Bytes = new TextEncoder().encode(input); | ||
let binaryString = ''; | ||
utf8Bytes.forEach(byte => binaryString += String.fromCharCode(byte)); | ||
return btoa(binaryString); | ||
} | ||
|
||
|
||
function decodeBase64(base64Str) | ||
{ | ||
const binaryString = atob(base64Str); | ||
const len = binaryString.length; | ||
const bytes = new Uint8Array(len); | ||
|
||
for (let i = 0; i < len; i++) | ||
{ | ||
bytes[i] = binaryString.charCodeAt(i); | ||
} | ||
|
||
return new TextDecoder().decode(bytes); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
async function sendGetRequest() | ||
{ | ||
const url = 'http://<url>'; | ||
|
||
const response = await fetch(url, { | ||
method: 'GET', | ||
}); | ||
|
||
if (!response.ok) | ||
{ | ||
throw new Error(`Error: ${response.statusText}`); | ||
} | ||
|
||
return await response.json(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from flask_cors import CORS | ||
|
||
app = Flask(__name__) | ||
|
||
# enable Cross-Origin-Ressource-Sharing | ||
CORS(app) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@app.route('/receiveGet', methods=['GET']) | ||
def receiveGet(): | ||
parameter = request.args.get('parameter') | ||
print(parameter) | ||
return response, 200; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@app.route('/receivePost', methods=['POST']) | ||
def receivePost(): | ||
incomingJson = request.get_json() | ||
return jsonify({"message": "Data successfully received"}), 20 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters