diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..db3b911 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.py] +indent_size = 4 diff --git a/.gitignore b/.gitignore index f7275bb..5c2e673 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ venv/ +*.pyc diff --git a/backend/README.md b/backend/README.md index 05cec1f..d6df9d2 100644 --- a/backend/README.md +++ b/backend/README.md @@ -1,4 +1,4 @@ -# Cancymat Backend +# Candymat Backend The backend providing the data and managing changing the data. diff --git a/backend/data/fragen.json b/backend/data/fragen.json new file mode 100644 index 0000000..2713df9 --- /dev/null +++ b/backend/data/fragen.json @@ -0,0 +1,6 @@ +[ + { + "id": 0, + "text": "Dies ist eine Dummy Frage für Testzwecke" + } +] \ No newline at end of file diff --git a/backend/data/kandidaten.json b/backend/data/kandidaten.json new file mode 100644 index 0000000..9cf0068 --- /dev/null +++ b/backend/data/kandidaten.json @@ -0,0 +1,14 @@ +[ + { + "id": 0, + "vorname": "Max", + "name": "Mustermann", + "email": "max.mustermann@yahoo.com" + }, + { + "id": 1, + "vorname": "Erika", + "name": "Mustermann", + "email": "erika.mustermann@yahoo.com" + } +] \ No newline at end of file diff --git a/backend/dev-setup.sh b/backend/dev-setup.sh index e91cf82..d572c8f 100755 --- a/backend/dev-setup.sh +++ b/backend/dev-setup.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + python -m venv venv source venv/bin/activate diff --git a/backend/dev-start.sh b/backend/dev-start.sh new file mode 100755 index 0000000..d01d772 --- /dev/null +++ b/backend/dev-start.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +source venv/bin/activate + +env FLASK_APP=flask-server/main.py flask run diff --git a/backend/flask-server/main.py b/backend/flask-server/main.py new file mode 100644 index 0000000..dd8e3ec --- /dev/null +++ b/backend/flask-server/main.py @@ -0,0 +1,21 @@ +from flask import Flask, escape, request +import json +import os + +app = Flask(__name__) + +@app.route('/') +def root(): + return "Candymat Data Backend" + + +@app.route('/fragen') +def fragen(): + with open('data/fragen.json', 'r') as json_file: + return json_file.read() + + +@app.route('/kandidaten') +def kandidaten(): + with open('data/kandidaten.json', 'r') as json_file: + return json_file.read()