Delete api directory

This commit is contained in:
Galax 2021-09-17 13:49:25 +07:00 committed by GitHub
parent bbe32cb6b7
commit d3ab3754da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,24 +0,0 @@
import requests
from flask import Flask, send_from_directory
app = Flask(__name__)
@app.route("/")
@app.route("/<string:file>")
def startpage(file = None):
if not file:
return send_from_directory("../", "index.html")
else:
return send_from_directory("../", file)
@app.route("/ac/<string:query>")
def deal_with_cors(query):
return {"data": requests.get(f"https://ac.duckduckgo.com/ac/?q={query}&type=list").json()[1]}
@app.after_request
def actually_deal_with_cors(res):
res.headers["Access-Control-Allow-Origin"] = "startpage.galax.tech"
return res