main.py 891 B

12345678910111213141516171819202122232425262728293031323334
  1. from fastapi import FastAPI
  2. from .api import vector, raster
  3. from .database import engine, Base
  4. # 创建数据库表
  5. Base.metadata.create_all(bind=engine)
  6. app = FastAPI(
  7. title="地图数据处理系统",
  8. description="一个用于处理地图数据的API系统",
  9. version="1.0.0",
  10. openapi_tags=[
  11. {
  12. "name": "vector",
  13. "description": "矢量数据相关接口",
  14. },
  15. {
  16. "name": "raster",
  17. "description": "栅格数据相关接口",
  18. }
  19. ]
  20. )
  21. # 注册路由
  22. app.include_router(vector.router, prefix="/api/vector", tags=["vector"])
  23. app.include_router(raster.router, prefix="/api/raster", tags=["raster"])
  24. @app.get("/")
  25. async def root():
  26. return {"message": "Welcome to the GIS Data Management API"}
  27. # if __name__ == "__main__":
  28. # import uvicorn
  29. # uvicorn.run(app, host="0.0.0.0", port=8000)