forked from CS-ISE-Project/back-end
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (28 loc) · 1.49 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
35
36
37
38
39
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from pathlib import Path
from fastapi.staticfiles import StaticFiles
from app.routers import user_router, admin_router, moderator_router, article_router, favorite_router, auth_router, search_router, upload_router, moderation_router, modifications_router
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_credentials=True,
allow_origins=["*"],
allow_headers=["*"],
allow_methods=['GET', 'POST', 'PUT', 'DELETE'],
)
from app.config.config import UPLOAD_DIR
app.mount("/files", StaticFiles(directory=Path(UPLOAD_DIR)), name="files")
@app.get("/")
async def root():
return {"message": "Hello Researcher!"}
app.include_router(auth_router.router, prefix="/auth", tags=["auth"])
app.include_router(user_router.router, prefix="/users", tags=["users"])
app.include_router(admin_router.router, prefix="/admins", tags=["admins"])
app.include_router(moderator_router.router, prefix="/moderators", tags=["moderators"])
app.include_router(article_router.router, prefix="/articles", tags=["articles"])
app.include_router(search_router.router, prefix="/search", tags=["search"])
app.include_router(favorite_router.router, prefix="/favorites", tags=["favorites"])
app.include_router(modifications_router.router, prefix="/modifications", tags=["modifications"])
app.include_router(moderation_router.router, prefix="/moderation", tags=["moderation"])
app.include_router(upload_router.router, prefix="/upload", tags=["upload"])