
- Implement user authentication with JWT tokens - Add messaging system for sending/receiving messages - Create SQLite database with SQLAlchemy models - Set up Alembic for database migrations - Add health check endpoint - Include comprehensive API documentation - Support user registration, login, and message management - Enable conversation history and user listing
32 lines
822 B
Python
32 lines
822 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from pathlib import Path
|
|
|
|
from app.routers import auth, messages, health
|
|
|
|
app = FastAPI(
|
|
title="Simple Messaging App",
|
|
description="A simple messaging application built with FastAPI",
|
|
version="1.0.0",
|
|
openapi_url="/openapi.json"
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router, prefix="/auth", tags=["auth"])
|
|
app.include_router(messages.router, prefix="/messages", tags=["messages"])
|
|
app.include_router(health.router, tags=["health"])
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {
|
|
"title": "Simple Messaging App",
|
|
"documentation": "/docs",
|
|
"health_check": "/health"
|
|
} |