mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
basic portfolio api
This commit is contained in:
parent
d9de9cf67e
commit
28a5f3bdee
2 changed files with 17 additions and 3 deletions
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue