Complete Rewrite
This commit is contained in:
@@ -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.
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
MONGO_URI=""
|
||||
|
||||
PORT=80
|
||||
|
||||
Binary file not shown.
@@ -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']
|
||||
@@ -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'])
|
||||
Reference in New Issue
Block a user