-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
39 lines (28 loc) · 866 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
37
38
39
import flask
from flask import Flask, jsonify
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def index():
return 'ddd'
# http://127.0.0.1:5000/test
# http://localhost:15000/test
@app.route("/test")
def test():
return 'test'
# http://127.0.0.1:5000/test2
# http://localhost:15000/test2
@app.route("/test2")
def test2():
data = {"success": True, "status": "success", "message": "성공하였습니다."}
return jsonify(data)
# http://127.0.0.1:5000/test3?name=123
# http://localhost:15000/test3?name=123
@app.route("/test3")
def test3():
name = flask.request.args.get('name')
data = {"success": True, "status": "success", "message": "성공하였습니다.", "name": name}
return jsonify(data)
# flask run -p 5000
if __name__ == '__main__':
app.run(debug=True)
# app.run('0.0.0.0', port=5000, debug=True)