Add main.py
This commit is contained in:
24
main.py
Normal file
24
main.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
from fastapi import FastAPI
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
app = FastAPI(title='솔메카 FastAPI Demo')
|
||||||
|
|
||||||
|
@app.get('/')
|
||||||
|
def root():
|
||||||
|
return {
|
||||||
|
'message': '솔메카 FastAPI 데모 앱',
|
||||||
|
'status': 'running',
|
||||||
|
'time': datetime.now().isoformat()
|
||||||
|
}
|
||||||
|
|
||||||
|
@app.get('/health')
|
||||||
|
def health():
|
||||||
|
return {'status': 'ok'}
|
||||||
|
|
||||||
|
@app.get('/api/items')
|
||||||
|
def items():
|
||||||
|
return [
|
||||||
|
{'id': 1, 'name': 'Item A', 'price': 1000},
|
||||||
|
{'id': 2, 'name': 'Item B', 'price': 2000},
|
||||||
|
{'id': 3, 'name': 'Item C', 'price': 3000},
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user