Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*__pycache__*
venv/
logs/
.env
*.env
10 changes: 8 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ async def lifespan(app: FastAPI):
yield



def initiate_app():
app = FastAPI(
title="FastAPI Sample Project",
summary="API for FastAPI Sample Project",
title= settings.PROJECT_NAME,
summary=settings.PROJECT_SUMMARY,
lifespan=lifespan,
)


origins = [
# Add allowed origins here
]
Expand Down Expand Up @@ -66,6 +68,10 @@ def initiate_app():

app = initiate_app()

@app.get("/")
def read_root():
return {"message: FastAPI project structure"}


@app.exception_handler(HTTPException)
async def http_exception_handler(request: Request, exc: HTTPException):
Expand Down
3 changes: 3 additions & 0 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ class Settings(BaseSettings):

JWT_SECRET: str # required environment variable
JWT_ALGORITHM: str = "HS256" # optional environement variable with default value

PROJECT_NAME: str = "FastAPI Sample Project"
PROJECT_SUMMARY: str = "API for FastAPI Sample Project"