Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEhler2 committed Jan 27, 2024
1 parent 673ac88 commit 93c6b35
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: uvicorn run:app --host 0.0.0.0 --port $PORT
web: gunicorn run:app --host 0.0.0.0 --port $PORT
Binary file modified requirements.txt
Binary file not shown.
27 changes: 13 additions & 14 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import time
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from flask import Flask
from flask.helpers import send_from_directory
from flask_cors import CORS, cross_origin

app = FastAPI()
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app = Flask(__name__, static_folder='ufarms-react-client/build', static_url_path='')
CORS(app)

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

### note ###
# we will create all routes here until further notice
@app.route('/')
def serve():
return send_from_directory(app.static_folder, 'index.html')

if __name__ == '__main__':
app.run()

0 comments on commit 93c6b35

Please sign in to comment.