slight refactor
This commit is contained in:
parent
82a774e318
commit
7067130d36
|
|
@ -11,7 +11,7 @@ app = Flask(__name__)
|
||||||
api = Api(app, version='1', contact={"name":""}, license={"name":"Online Dienst Dokumentation"}, api_spec_url='/api/swagger')
|
api = Api(app, version='1', contact={"name":""}, license={"name":"Online Dienst Dokumentation"}, api_spec_url='/api/swagger')
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
api.add_resource(endpoints.RecipeList,'/api/v1/recipe/')
|
api.add_resource(endpoints.RecipeList,'/api/v1/recipe/')
|
||||||
api.add_resource(endpoints.Images,'/api/v1/images/<string:id>')
|
api.add_resource(endpoints.Images,'/api/v1/recipe/<string:id>/image')
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import enum
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
import time
|
import time
|
||||||
|
|
||||||
engine = db.create_engine('mysql+mysqldb://root@server/fs2?charset=utf8mb4', echo=False, encoding="utf8", pool_size=1000, max_overflow=0)
|
engine = db.create_engine('mysql+mysqldb://root@server/fs2?charset=utf8mb4', echo=False, encoding="utf8", pool_size=1000, max_overflow=0, pool_pre_ping=True)
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
Session = sessionmaker(bind=engine, autoflush=False)
|
Session = sessionmaker(bind=engine, autoflush=False)
|
||||||
|
|
|
||||||
|
|
@ -120,4 +120,4 @@ def calcOverlay2(l1, l2):
|
||||||
|
|
||||||
|
|
||||||
# it is assumed that everyone has this
|
# it is assumed that everyone has this
|
||||||
defaultArr = ["Wasser", "salz", "pfeffer"]
|
defaultArr = ["wasser", "salz", "pfeffer"]
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ function loadRecipes(getParams){
|
||||||
function (error, data) {
|
function (error, data) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
rl.innerHTML = "<p>Es gab einen Fehler, bitte suchen Sie erneut.</p>"
|
rl.innerHTML = "<p>Es gab einen Fehler, bitte suchen Sie erneut.</p>"
|
||||||
|
insertValueIntoSearchbar()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -52,6 +52,11 @@ function renderIgnored(ignored){
|
||||||
document.getElementById("search-form").innerHTML += `<span class="badge badge-danger badge-pill">${item}</span>`
|
document.getElementById("search-form").innerHTML += `<span class="badge badge-danger badge-pill">${item}</span>`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
insertValueIntoSearchbar()
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertValueIntoSearchbar(){
|
||||||
let url = window.location.href
|
let url = window.location.href
|
||||||
params = url.split("?")[1]
|
params = url.split("?")[1]
|
||||||
if (params !== undefined){
|
if (params !== undefined){
|
||||||
|
|
@ -62,7 +67,6 @@ function renderIgnored(ignored){
|
||||||
params = "?" + params
|
params = "?" + params
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeGetParamString(){
|
function makeGetParamString(){
|
||||||
|
|
@ -118,7 +122,7 @@ function renderRecipeList(data){
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-5 col-sm-5 col">
|
<div class="col-lg-5 col-sm-5 col">
|
||||||
<a href="${data1[2]}" target="_blank">
|
<a href="${data1[2]}" target="_blank">
|
||||||
<img class="recipe-img" src="/api/v1/images/${data1[0]}">
|
<img class="recipe-img" src="/api/v1/recipe/${data1[0]}/image">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg col-sm col">
|
<div class="col-lg col-sm col">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue