jungil commited on
Commit
1084245
Β·
1 Parent(s): 326cd82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -1,13 +1,17 @@
1
- from fastapi import FastAPI
2
 
3
- # FastAPI μΈμŠ€ν„΄μŠ€ 생성
4
- app = FastAPI()
5
 
6
- # 라우트 생성
7
- @app.get("/")
8
- def read_root():
9
- return {"Hello": "World"}
10
 
11
- @app.get("/items/{item_id}")
12
- def read_item(item_id: int, q: str = None):
13
- return {"item_id": item_id, "q": q}
 
 
 
 
 
 
1
+ from flask import Flask
2
 
3
+ app = Flask(__name__)
 
4
 
5
+ # μ›Ή μ„œλΉ„μŠ€μ˜ 루트 URL에 접속할 λ•Œμ˜ λ™μž‘μ„ μ •μ˜ν•©λ‹ˆλ‹€.
6
+ @app.route('/')
7
+ def index():
8
+ return 'μ•ˆλ…•ν•˜μ„Έμš”! 이것은 κ°„λ‹¨ν•œ μ›Ή μ„œλΉ„μŠ€μž…λ‹ˆλ‹€.'
9
 
10
+ # λ‹€λ₯Έ κ²½λ‘œμ— 접속할 λ•Œμ˜ λ™μž‘μ„ μ •μ˜ν•  μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.
11
+ @app.route('/hello')
12
+ def hello():
13
+ return 'μ•ˆλ…•ν•˜μ„Έμš”! Flaskλ₯Ό μ΄μš©ν•œ μ›Ή μ„œλΉ„μŠ€μ— μ˜€μ‹  것을 ν™˜μ˜ν•©λ‹ˆλ‹€.'
14
+
15
+ if __name__ == '__main__':
16
+ # μ„œλ²„λ₯Ό μ‹€ν–‰ν•©λ‹ˆλ‹€. 디버그 λͺ¨λ“œλ₯Ό ν™œμ„±ν™”ν•˜λ©΄ μ½”λ“œ 변경이 μžλ™μœΌλ‘œ λ°˜μ˜λ©λ‹ˆλ‹€.
17
+ app.run(debug=True)