@app.middleware("http")
async def process_http_requests(request, call_next):
url = str(request.url)
print(f"Request information: {request.url}")
if '.html' in url or '.css' in url or '.svg' in url:
file_path = url.split(':6999')[1]
return FileResponse(f".{file_path}")
elif '.js' in url:
headers = {
"Content-Type":"application/javascript; charset=UTF-8"
}
file_path = url.split(':6999')[1]
return FileResponse(f".{file_path}", headers=headers)
else:
response = await call_next(request)
return response
fastapi 与 vue结合,进行前后端不分离的方式部署,返回dist文件
最新推荐文章于 2025-04-21 17:27:26 发布