12 lines
397 B
Python
12 lines
397 B
Python
from fastapi import APIRouter, status, Depends
|
|
from typing import List
|
|
from schemas.fruit import FruitSchema
|
|
from helpers.fruit_helpers import get_all_fruits
|
|
from db import get_db, Session
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/fruits", status_code=status.HTTP_200_OK, response_model=List[FruitSchema])
|
|
def get_fruits(db: Session = Depends(get_db)):
|
|
fruits = get_all_fruits(db)
|
|
return fruits |