-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
36 lines (29 loc) · 779 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from backend import *
from flask import Flask, request, jsonify, render_template, url_for
app = Flask(__name__)
@app.before_first_request
def start():
os.system('''cmd /c "start /min cmd.exe /c backend.exe "''')
@app.route('/')
def home():
return render_template('home.html')
@app.errorhandler(404)
def error(error):
return "404--Not Found"
@app.route('/api')
def api():
word = request.args.get('word')
data = autoComplete(list(word.split(" "))[-1])
d = dict()
for i in range(0,len(data)):
d[i] = data[i]
return(jsonify(d))
@app.route('/api/save')
def save():
word = request.args.get('data')
f = open("static/untitled.txt",'w')
f.write(word)
f.close()
return "0"
if __name__=="__main__":
app.run(debug=True)