Reorganize project structure
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
from fastapi import FastAPI, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
from . import models, database
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@app.on_event("startup")
|
||||
def startup():
|
||||
models.Base.metadata.create_all(bind=database.engine)
|
||||
|
||||
@app.get("/users/")
|
||||
def read_users(db: Session = Depends(database.get_db)):
|
||||
users = db.query(models.User).all()
|
||||
return users
|
||||
Reference in New Issue
Block a user