Python API works now

This commit is contained in:
Shaun Orssaud 2023-11-01 18:11:34 +09:00
parent 033c3e7437
commit 30692fe0db
5 changed files with 17 additions and 15 deletions

View File

@ -10,6 +10,15 @@ CORS(app)
def root():
return jsonify({'message': 'Welcome to the API!'})
@app.route('/debug')
def debug():
base_url = request.headers.get('Base-Url')
response = requests.get(
f'{base_url}/api/codex/v1/debug/info'
)
print(response.status_code)
print(response.text)
return response.text
@app.route('/upload', methods=['POST'])
def upload():

View File

@ -15,8 +15,4 @@ server {
expires 1y;
add_header Cache-Control "public";
}
location /uploads {
proxy_pass http://localhost:5000;
}
}

View File

@ -4,7 +4,8 @@ services:
context: .
dockerfile: Dockerfile.api
image: codex-frontend-api
network_mode: "host"
ports:
- "5000:5000"
client:
build:
context: .

View File

@ -1 +1 @@
REACT_APP_CODEX_URL=http://localhost:8080
REACT_APP_CODEX_URL=http://host.docker.internal:8080

View File

@ -8,6 +8,7 @@ import {
import NodeInfoItemComponent from "../../components/nodeInfoItem/NodeInfoItemComponent";
import Header from "../../components/layout/partials/Header";
import { useDexyStore } from "../../store";
import constants from "../../util/Constants";
function DebugPage() {
const { nodeInfo } = useDexyStore();
@ -15,20 +16,15 @@ function DebugPage() {
const [statusInfo, setStatusInfo] = React.useState<
DebugNodeInfoModel | undefined
>();
useEffect(() => {
axios
.get(
`${
nodeInfo.nodeToConnectTo || nodeInfo.baseUrl
}/api/codex/v1/debug/info`,
`${constants.testApiBaseUrl}/debug`,
{
headers:
(nodeInfo.auth !== null && {
Authorization:
(nodeInfo.auth && "Basic " + btoa(nodeInfo.auth)) || "",
}) ||
{},
({
"Base-Url": nodeInfo.baseUrl,
}),
}
)
.then((response) => {