fs-walle-react-ts/walle-server.py

24 lines
649 B
Python
Raw Normal View History

2017-07-12 06:40:24 +00:00
from flask import Flask,send_from_directory
app = Flask(__name__,static_url_path='',static_folder='build')
2017-07-18 10:24:19 +00:00
import requests
2017-07-12 06:40:24 +00:00
@app.route('/')
def walle_index():
2017-07-12 06:40:24 +00:00
return app.send_static_file('index.html')
@app.route('/test')
def walle_test():
return "test"
2017-07-13 11:38:27 +00:00
2017-07-18 10:24:19 +00:00
# hmr streaming
# from flask import Response,stream_with_context
# @app.route('/sockjs-node/<path:url>',methods=['GET','POST'])
# def walle_hmr(url):
# webpack_server = 'http://localhost:3000/sockjs-node/'
# req = requests.get(webpack_server+url, stream = True)
# return Response(stream_with_context(req.iter_content()))
2017-07-13 11:38:27 +00:00
if __name__ == '__main__':
app.run(debug=True)