from flask import Flask,send_from_directory,request app = Flask(__name__,static_url_path='',static_folder='build') from freespeech_walle.get_morph_rule import get_morph import json @app.route('/') def walle_index(): return app.send_static_file('index.html') @app.route('/test') def walle_test(): return "test" @app.route('/morph') def walle_morph(): word = request.args.get('word') pos = request.args.get('pos') return json.dumps(get_morph(word,pos)) # hmr streaming # import requests # from flask import Response,stream_with_context # @app.route('/',methods=['GET','POST']) # def walle_hmr(url): # webpack_server = 'http://localhost:3000/' # req = requests.get(webpack_server+url, stream = True) # return Response(stream_with_context(req.iter_content())) if __name__ == '__main__': app.run(debug=True)