import os import dotenv import fastapi import fastapi.staticfiles import fastapi.responses import assets dotenv.load_dotenv() print("Loading cx-notes...") print("Note name:", os.getenv("notes_name")) print("Database:", os.getenv("database")) api = fastapi.FastAPI() static = fastapi.staticfiles.StaticFiles(directory = "./static") database = assets.storage(os.getenv("database")) app = assets.notes(os.getenv("notes_name"), database) api.mount("/static/", static) @api.get("/", response_class = fastapi.responses.HTMLResponse) async def index(): try: with open("./static/core.html") as index: return index.read() except: return "Error 404. Can not open file."