41 lines
991 B
Python
41 lines
991 B
Python
from fastapi import FastAPI
|
|
from fastapi.responses import ORJSONResponse
|
|
|
|
from nyekiapi.lib import settings
|
|
from nyekiapi.api.lifespan import lifespan
|
|
from nyekiapi.api.v2 import app as app_v2
|
|
from nyekiapi.api.v2.errors import NotFoundError
|
|
|
|
|
|
app = FastAPI(
|
|
debug=settings.DEBUG,
|
|
docs_url=None,
|
|
redoc_url=None,
|
|
lifespan=lifespan,
|
|
default_response_class=ORJSONResponse,
|
|
)
|
|
|
|
|
|
@app.get("/")
|
|
def index():
|
|
return {
|
|
"title": "Nyeki's API",
|
|
"message": "Welcome to Nyeki's API! Refer to each version's documentation for more information.",
|
|
"versions": {
|
|
"v1": {
|
|
"base": "https://api.nyeki.dev/v1",
|
|
"docs": "https://api.nyeki.dev/v1/docs",
|
|
},
|
|
"v2": {
|
|
"base": "https://api.nyeki.dev/v2",
|
|
"docs": "https://api.nyeki.dev/v2/docs",
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
app.add_exception_handler(404, NotFoundError.handler)
|
|
|
|
|
|
app.mount("/v2", app_v2, name="v2")
|