diff --git a/app/main.py b/app/main.py index e69de29..5dfe2c7 100644 --- a/app/main.py +++ b/app/main.py @@ -0,0 +1,11 @@ +from fastapi import FastAPI + +from .routers import users + +app = FastAPI() + +app.include_router(users.router) + +@app.get("/") +async def root(): + return {"message": "Hello World !"} \ No newline at end of file diff --git a/app/models/__init__.py b/app/models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/models/users.py b/app/models/users.py new file mode 100644 index 0000000..b3da0b6 --- /dev/null +++ b/app/models/users.py @@ -0,0 +1,12 @@ +from pydantic import BaseModel +from pydantic_mongo import AbstractRepository, ObjectIdField + + +class Users(BaseModel): + id: ObjectIdField = None + username: str + + +class UsersRepository(AbstractRepository[Users]): + class Meta: + collection_name = users \ No newline at end of file diff --git a/app/routers/__init__.py b/app/routers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requierements.txt b/requierements.txt index 8e0578a..13a6b2c 100644 --- a/requierements.txt +++ b/requierements.txt @@ -1,2 +1,3 @@ fastapi -uvicorn[standard] \ No newline at end of file +uvicorn[standard] +pydantic-mongo \ No newline at end of file