Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AshminJayson committed Sep 22, 2023
0 parents commit 265a808
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fapi
**__pycache__
env.py
28 changes: 28 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from fastapi import FastAPI
import uvicorn
from store import db

app = FastAPI()

def run_init():
try:
import env
env.init()
except (e) as e:
print(e)
db.init()

def run_tests():
# print(db.get_all_shops().data)
return


@app.get('/')
async def hello():
return {'message': 'go to /docs to test the routes'}


if __name__ == '__main__':
run_init()
run_tests()
uvicorn.run(app, host="0.0.0.0", port=8000)
Binary file added requirements.txt
Binary file not shown.
Empty file added store/__init__.py
Empty file.
22 changes: 22 additions & 0 deletions store/db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
from supabase import create_client, Client

SUPABASE_PUBLIC_URL : str = ''
SUPABASE_SERVICE_ROLE : str = ''
supabase: Client = None


def init():
global SUPABASE_PUBLIC_URL, SUPABASE_SERVICE_ROLE, supabase
SUPABASE_PUBLIC_URL = os.environ.get('SUPABASE_PUBLIC_URL')
SUPABASE_SERVICE_ROLE = os.environ.get('SUPABASE_SERVICE_ROLE')
supabase = create_client(supabase_url=SUPABASE_PUBLIC_URL, supabase_key=SUPABASE_SERVICE_ROLE)


def get_all_shops():
shop_records = supabase.table('shop').select("*").execute()
return shop_records




0 comments on commit 265a808

Please sign in to comment.