I am learning to use fastapi on Windows. The problem is that I cannot access any endpoint different than localhost ("/").
I have written a following code in main.py file that is located inside app folder (app folder contains init.py file and main.py file):
from fastapi import FastAPI
app = FastAPI()
my_posts = { 1:{
"date":"01/01/2022",
"user":"Matt",
"type":"photo"
}
}
@app.get("/")
def get_root():
return{"Hello":"User"} #works fine
@app.get("/post/{post_id}")
def get_post(post_id:int):
return{"data": my_posts} #doesn't work