diff --git a/endpoints/countries.get.py b/endpoints/countries.get.py new file mode 100644 index 0000000..f660f35 --- /dev/null +++ b/endpoints/countries.get.py @@ -0,0 +1,16 @@ +# Entity: Country +from fastapi import APIRouter, Depends, status +from sqlalchemy.orm import Session +from typing import List +from app.api.db.database import get_db +from app.api.models.country import Country +from app.api.schemas.country import CountrySchema + +router = APIRouter() + +@router.get("/countries", status_code=200, response_model=List[CountrySchema]) +async def get_countries( + db: Session = Depends(get_db) +): + countries = db.query(Country).all() + return countries \ No newline at end of file