-
-
Save nishio/be5b5071a8c8fb94836b to your computer and use it in GitHub Desktop.
server.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, send_from_directory | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'ok' # TODO: show index | |
@app.route('/collecting/<path:filename>') | |
def send_foo(filename): | |
print filename | |
return send_from_directory('../collecting', filename) | |
@app.route('/api/save/<filename>', methods=['POST']) | |
def save(filename): | |
print filename | |
print request.form['data'] | |
file(filename, 'w').write(request.form['data']) | |
return 'ok' | |
if __name__ == '__main__': | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment