From 28a5f3bdee968630b0004af5f9acce7fe5e73511 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 6 Jul 2023 10:24:06 +0100 Subject: [PATCH] basic portfolio api --- backend/README.md | 10 ++++++++++ backend/main.py | 10 +++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/backend/README.md b/backend/README.md index 3e7dc106..61d0663e 100644 --- a/backend/README.md +++ b/backend/README.md @@ -2,6 +2,16 @@ This is the api service that will supply the frontend with the insights that are driven by the machine learning and data modelling services. +# Usage + +## Local + +For running the serice locally, natigate to the backend directory and run the following command: + +```bash +uvicorn main:app --reload +``` + ### Thoughts for authenticating the frontend with the backend To provide secure communication between your frontend Next.js application and your backend FastAPI service, you have several options. Here are a few popular approaches: diff --git a/backend/main.py b/backend/main.py index ee60be1f..35db91d1 100644 --- a/backend/main.py +++ b/backend/main.py @@ -3,6 +3,10 @@ from fastapi import FastAPI app = FastAPI() -@app.get("/") -async def root(): - return {"message": "Hello World"} +@app.get("/portfolio/{portfolio_id}") +async def get_portfolio(portfolio_id: int): + return { + "portfolio_id": portfolio_id, + "name": "My Portfolio", + "description": "This is my portfolio", + }