Added more backend

This commit is contained in:
CHIEFSOFT\ameye
2024-12-08 07:18:59 -05:00
parent 9e7edd2902
commit 321b4fb49c
2 changed files with 16 additions and 2 deletions
+14 -1
View File
@@ -1,4 +1,6 @@
import os
import psycopg2
from dotenv import load_dotenv
from flask import (
Flask,
@@ -9,6 +11,7 @@ from flask import (
from flask_sqlalchemy import SQLAlchemy
from werkzeug.utils import secure_filename
load_dotenv()
app = Flask(__name__)
app.config.from_object("project.config.Config")
@@ -25,13 +28,23 @@ class User(db.Model):
def __init__(self, email):
self.email = email
dataUrl = os.getenv("DATABASE_URL")
connection = psycopg2.connect(dataUrl)
@app.route("/")
def hello_world():
return jsonify(hello="ameye world")
GLOBAL_AVG = """SELECT * FROM members WHERE id = 1;"""
with connection:
with connection.cursor() as cursor:
cursor.execute(GLOBAL_AVG)
account = cursor.fetchone()
#return jsonify(hello="ameye world")
return {"account": account}
@app.route("/auth/login")
def statrt_login():
return jsonify(hello="ameye world")
@app.route("/auth/register")
+2 -1
View File
@@ -3,4 +3,5 @@ Flask-SQLAlchemy==3.0.3
gunicorn==20.1.0
psycopg2-binary==2.9.6
flask-smorest==0.42.3
psycopg2-binary
python-dotenv
python-jwt