Skip to content

Commit

Permalink
switched to fastapi for backend simplified requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEhler2 committed Jan 27, 2024
1 parent c1f884c commit d35f1ce
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 90 deletions.
Binary file modified requirements.txt
Binary file not shown.
60 changes: 0 additions & 60 deletions requirements_prod.txt

This file was deleted.

44 changes: 15 additions & 29 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
import time
from flask import Flask

app = Flask(__name__)

@app.route('/time')
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

app = FastAPI()
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

@app.get("/time")
def get_current_time():
return {'time': time.time()}

### note ###
# we will create all routes here until further notice


# ## If things are going to be like this I might shift the stack to FastAPI newer -- it's a Flask killer
# Fast example of the above route using Fast

# from fastapi import FastAPI
# app = FastAPI()
# @app.get("/")
# def get_current_time():
# return {'time': time.time()}


# ---
## A draw back of flask is that it requires these sneaky circular-prone imports -- in my experience 90% of the time this is what's causing the error, including the one today -- I think I recall a method for addressing that
# from app import app
# from config import Config

# app.secret_key = Config.SECRET_KEY # Set a secret key for flash messages

# # if __name__ == '__main__':
# # app.run(debug=True)
# if __name__ == '__main__':
# app.run(host='0.0.0.0', port=5000, debug=True)
# we will create all routes here until further notice
2 changes: 1 addition & 1 deletion ufarms-react-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
"last 1 safari version"
]
},
"proxy": "http://localhost:5000/"
"proxy": "http://localhost:8000/"
}

0 comments on commit d35f1ce

Please sign in to comment.