30 lines
701 B
Python
30 lines
701 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.routers import tasks, health
|
|
from app.database import create_tables
|
|
|
|
app = FastAPI(
|
|
title="Fast Task Manager API",
|
|
description="A simple API for managing tasks",
|
|
version="0.1.0",
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(tasks.router, prefix="/api/v1")
|
|
app.include_router(health.router)
|
|
|
|
@app.on_event("startup")
|
|
async def startup_event():
|
|
create_tables()
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) |