-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (30 loc) · 1.07 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from fastapi import FastAPI
from app.database import Base, engine
from app.routers import blog, comments, users, auth
from app import models
#initializing FastAPI app
app = FastAPI(
title="Blog Platform API",
description="A RESTful API for managing blog posts and comments with role-based access.",
version="1.0.0",
contact={
"name": "Maryam Yousefi",
"email": "[email protected]",
},
)
#automatically create database tables
Base.metadata.create_all(bind=engine)
#include routers for modular endpoints
app.include_router(blog.router, prefix="/blogs", tags=["blogs"])
app.include_router(comments.router, prefix="/comments", tags=["comments"])
app.include_router(users.router, prefix="/users", tags=["users"])
app.include_router(auth.router, prefix="/auth", tags=["authentication"])
app = FastAPI(
title="Blog Platform API",
description="A RESTful API for managing blog posts and comments with role-based access.",
version="1.0.0",
contact={
"name": "Maryam Yousefi",
"email": "[email protected]",
},
)