Skip to content

Commit 9439886

Browse files
surajitsurajit
authored andcommitted
version api
1 parent 4abfd1a commit 9439886

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from fastapi import Request
33
from fastapi.templating import Jinja2Templates
44

5-
from routes import email
6-
from routes import contact
7-
from routes import company
5+
from routes.v1 import email
6+
from routes.v1 import contact
7+
from routes.v1 import company
88

99
app = FastAPI()
1010
app.include_router(email.router)

readme.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ payment. The Organization makes the payment and a payment record is saved in the
2424
- create .env file and add the keys for env-example
2525
- alembic upgrade head (to migrate)
2626
- uvicorn app:app --reload (to run server)
27+
- /docs - to view available endpoints
28+
29+
# Endpoints - v1 (Version 1)
30+
31+
Contact
32+
- /api/v1/contacts/ - POST - Create a Contact
33+
- /api/v1/contact/<email>/ - GET email by contact
34+
35+
Company
36+
- /api/v1/companies/ - POST - Create a Company/Organization
37+
- /api/v1/company/<company-name>/ - GET - Get company by Name
38+
39+
Email
40+
- /api/v1/email/send/ - POST - Send an email
41+
2742

2843
# External Integrations
2944

routes/v1/__init__.py

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from crud import company as _company
1111

1212
router = APIRouter(
13+
prefix='/api/v1',
1314
tags=["company"],
1415
responses={404: {"description": "Not found"}},
1516
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from crud import company as _company
1212

1313
router = APIRouter(
14+
prefix='/api/v1',
1415
tags=["contact"],
1516
responses={404: {"description": "Not found"}},
1617
)

routes/email.py renamed to routes/v1/email.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
from dependencies.dependencies import get_db
1616

1717
router = APIRouter(
18-
prefix="/email",
18+
prefix='/api/v1',
1919
tags=["email"],
2020
responses={404: {"description": "Not found"}},
2121
)
2222

2323

24-
@router.post("/send/")
24+
@router.post("/email/send/")
2525
async def send_email(request: Request, db: Session = Depends(get_db)):
2626
try:
2727
data = await request.json()

0 commit comments

Comments
 (0)