Complete Rewrite

This commit is contained in:
2024-09-14 11:04:06 -04:00
parent 926964f774
commit ec568c65b1
27 changed files with 2525 additions and 249 deletions

View File

@@ -1,4 +0,0 @@
## Food Decisive Backend
This is the backend for the Food Decisive app. It is a RESTful API that serves the frontend of the app. The backend is written in Python using the Flask framework.

View File

@@ -1,5 +0,0 @@
MONGO_URI=""
PORT=80

Binary file not shown.

View File

@@ -1,31 +0,0 @@
import pymongo
class MongoDB:
def __init__(self, config):
self.myclient = pymongo.MongoClient(config['MONGO_URI'])
self.users = Users(self.myclient)
self.recipes = Recipes(self.myclient)
## User Schema
class Users:
def __init__(self, db):
self.db = db
self.users = self.db.myclient['users']
## Recipe Schema
class Recipe:
def __init__(self, name, ingredients, instructions, user):
self.name = name
self.ingredients = ingredients
self.instructions = instructions
self.rating = 0
self.user = user
class Recipes:
def __init__(self, db):
self.db = db
self.recipes = self.db.myclient['recipes']

View File

@@ -1,16 +0,0 @@
from flask import Flask
from dotenv import dotenv_values
from db import MongoDB
config = dotenv_values(".env")
app = Flask(__name__)
app.storage = MongoDB(config)
@app.route("/", methods=['GET'])
def home():
return "Hello World"
app.run(port=config['PORT'])