Add Get endpoint for /cars
This commit is contained in:
parent
82c12e9bff
commit
e4a0df39dd
20
endpoints/cars.get.py
Normal file
20
endpoints/cars.get.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Entity: Car
|
||||
|
||||
from fastapi import APIRouter, status
|
||||
from typing import List
|
||||
|
||||
from core.models.car import Car
|
||||
from core.schemas.car import CarSchema
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/cars", status_code=status.HTTP_200_OK, response_model=List[CarSchema])
|
||||
def get_german_cars():
|
||||
german_cars = [
|
||||
Car(make="Volkswagen", model="Golf"),
|
||||
Car(make="BMW", model="3 Series"),
|
||||
Car(make="Mercedes-Benz", model="C-Class"),
|
||||
Car(make="Audi", model="A4"),
|
||||
Car(make="Porsche", model="911"),
|
||||
]
|
||||
return german_cars
|
Loading…
x
Reference in New Issue
Block a user