from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse from fastapi import FastAPI import json app = FastAPI() app.add_middleware(CORSMiddleware, allow_origins = ['*'], allow_credentials = True, allow_methods = ['*'], allow_headers = ['*']) @app.get('/') def index(): return JSONResponse(status_code = 200, content = {'status' : 'online'}) @app.get('/read') def read_route(): with open('cookies.json', 'r', encoding = 'utf-8') as file: data = json.load(file) return JSONResponse(status_code = 200, content = data)