40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
from constants import config
|
|
from fastapi import FastAPI, HTTPException, status
|
|
from fastapi.staticfiles import StaticFiles
|
|
from routes import router
|
|
|
|
app = FastAPI(
|
|
debug=False,
|
|
title=config['app'].get('title', 'LiveQ'),
|
|
description=config['app'].get(
|
|
'description', 'A multi-game queue for live streamers'),
|
|
docs_url=None,
|
|
redoc_url=None,
|
|
)
|
|
|
|
|
|
@app.get('/docs')
|
|
def docs():
|
|
raise HTTPException(
|
|
status_code=status.HTTP_302_FOUND,
|
|
headers=dict(Location='/api/docs')
|
|
)
|
|
|
|
|
|
@app.get('/redoc')
|
|
def docs():
|
|
raise HTTPException(
|
|
status_code=status.HTTP_302_FOUND,
|
|
headers=dict(Location='/api/redoc')
|
|
)
|
|
|
|
|
|
app.mount("/api", router, name="dynamic")
|
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
app.mount("/localcache", StaticFiles(directory="localcache"), name="localcache")
|
|
app.mount("/localqueue", StaticFiles(directory="localqueue"), name="localqueue")
|
|
app.mount("/", StaticFiles(directory="static", html=True), name="staticroot")
|