Limit methods to GET
This commit is contained in:
parent
8bd8bdf269
commit
fc74673bb2
|
@ -23,18 +23,18 @@ CONFIG_ENVVAR = 'REDSTRING_CONFIG'
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/', methods=['GET'])
|
||||||
def root():
|
def root():
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
|
||||||
@app.route('/index/')
|
@app.route('/index/', methods=['GET'])
|
||||||
def index():
|
def index():
|
||||||
document = generate_index_document(current_app.config['root'])
|
document = generate_index_document(current_app.config['root'])
|
||||||
return render_template('doc.jinja', document=document, index=True)
|
return render_template('doc.jinja', document=document, index=True)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/doc/<document_id>')
|
@app.route('/doc/<document_id>', methods=['GET'])
|
||||||
def document(document_id):
|
def document(document_id):
|
||||||
doc_path = safe_join(current_app.config['root'], f'{document_id}.json')
|
doc_path = safe_join(current_app.config['root'], f'{document_id}.json')
|
||||||
if not os.path.isfile(doc_path):
|
if not os.path.isfile(doc_path):
|
||||||
|
@ -44,7 +44,7 @@ def document(document_id):
|
||||||
return render_template('doc.jinja', document=doc, index=False)
|
return render_template('doc.jinja', document=doc, index=False)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/new/')
|
@app.route('/new/', methods=['GET'])
|
||||||
def new():
|
def new():
|
||||||
document_id = 'new'
|
document_id = 'new'
|
||||||
new_doc = generate_default_document(document_id)
|
new_doc = generate_default_document(document_id)
|
||||||
|
|
Loading…
Reference in New Issue