Demo for web-app, 3-tier. The rest-api written in flask/python. The API has several data-models to choose from, including flatfile, sqlite, mysql, etc.
OS:
- python3
- sqlite3 (apt install sqlite3)
Python packages
- pip3 install -r requirements.txt
- comment or uncomment in api/logic.py the desired model
- $ cd api/data/sqlite
- $ chmod +x createdb.sh
- $ ./createdb.sh
- (database 'data.db' is created in api/data)
- (setup a mysql-server with a admin-user)
- $ cd api/data/mysql
- (modify createdb.sh: replace server, user_name and password)
- $ chmod +x createdb.sh
- $ ./createdb.sh
- (database 'data' is created on the mysql-server)
Start API
- cd api
- python3 controller.py => localhost:5000
Start webserver:
- cd web/flask
- python3 controller.py => (browser) localhost:5001