Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "data"]
path = data
url = git@github.com:open-source-uch/malla-api-data.git
1 change: 1 addition & 0 deletions data
Submodule data added at c89d85
26 changes: 22 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
from fastapi import FastAPI
import json
import os

app = FastAPI()


@app.get("/")
async def root():
return {"message": "Hello World"}
return {"message": "Hello World"}

@app.get("/galleta")
async def get_source():
return {"ananan": 12}
@app.get("/fcfm/{version}/mallas/{major}")
async def major(version: str, major: str):
version_path = f"data/fcfm/{version}"
if not os.path.exists(version_path):
return {
"status": "error",
"message": f"Version {version} not found",
"code": 404,
}
major_path = version_path + f"/mallas/{major}/index.json"
if not os.path.exists(major_path):
return {
"status": "error",
"message": f"Major {major} not found",
"code": 404,
}

with open(major_path, "r") as f:
return json.load(f)