Can now retrieve icon
This commit is contained in:
parent
27f70b1221
commit
2b096baa88
1 changed files with 8 additions and 1 deletions
|
|
@ -1,7 +1,9 @@
|
|||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
from src.classes import product_classes
|
||||
from src.config import definitions
|
||||
from src import data_connection
|
||||
|
||||
app = FastAPI()
|
||||
|
|
@ -29,3 +31,8 @@ def get_all_products():
|
|||
@app.get("/products/{barcode}", response_model=product_classes.Product)
|
||||
def get_single_product(barcode: int):
|
||||
return data_connection.get_single_product(barcode)
|
||||
|
||||
@app.get("/icons/{icon_filename}", response_class=FileResponse)
|
||||
def get_icon(icon_filename: str):
|
||||
full_filepath = f"{definitions.ICONS_PATH}/{icon_filename}"
|
||||
return full_filepath
|
||||
Loading…
Reference in a new issue