-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (29 loc) · 981 Bytes
/
main.py
File metadata and controls
39 lines (29 loc) · 981 Bytes
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
34
35
36
37
38
39
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.routers import datasets, registry
from app.models.config import settings
app = FastAPI(
title="uMap Data API",
description="API to provide geospatial datasets for uMap instances",
version="1.0.0",
)
# CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # Configure appropriately for production
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routers
app.include_router(datasets.router, prefix="/api/v1")
app.include_router(registry.router, prefix="/api/v1")
@app.get("/")
async def root():
return {"message": "uMap Data API", "version": "1.0.0", "docs": "/docs"}
@app.get("/health")
async def health_check():
return {"status": "healthy"}
if __name__ == "__main__":
import uvicorn
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)