File size: 892 Bytes
5a2da96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api import detect, rephrase, grammar


app = FastAPI(
    title="Verbo Backend",
    description="Backend for Verbo Chrome Extension to detect and rephrase AI-generated text",
    version="1.0.0"
)

# CORS Setup
origins = [
    "http://localhost:8080",  # for local Vite frontend
    "https://verbo-ai.vercel.app",  # production
]

app.add_middleware(
    CORSMiddleware,
    allow_origins=origins,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# Register routes
app.include_router(detect.router, prefix="/api", tags=["AI Detection"])
app.include_router(rephrase.router, prefix="/api", tags=["Rephrasing"])
app.include_router(grammar.router, prefix="/api")

@app.get("/", tags=["Root"])
async def read_root():
    return {"message": "Welcome to the Verbo Backend API."}