update database.py and main.py
This commit is contained in:
+29
-3
@@ -1,6 +1,32 @@
|
||||
# Python backend for a calender for my friend group.
|
||||
# We had the problem of never agreeing when or where
|
||||
# we should meet up, and I hope this fixes the problem.
|
||||
# we should meet up, and I hope this fixes the problem.
|
||||
|
||||
from fastapi import FastAPI
|
||||
from database import fetch_all
|
||||
|
||||
app = FastAPI(
|
||||
title="Calendar API",
|
||||
description="Room based agenda system",
|
||||
version="0.1"
|
||||
)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def home():
|
||||
return {
|
||||
"status": "online",
|
||||
"service": "Calendar API"
|
||||
}
|
||||
|
||||
|
||||
@app.get("/database")
|
||||
def database_status():
|
||||
tables = fetch_all(
|
||||
"SELECT name FROM sqlite_master WHERE type='table';"
|
||||
)
|
||||
|
||||
return {
|
||||
"tables": [table["name"] for table in tables]
|
||||
}
|
||||
|
||||
import fastapi
|
||||
import time
|
||||
|
||||
Reference in New Issue
Block a user