mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 08:43:37 +00:00
Initial commit
This commit is contained in:
40
apps/backend/fastapi/project.json
Normal file
40
apps/backend/fastapi/project.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "backend-fastapi",
|
||||
"root": "apps/backend/fastapi",
|
||||
"sourceRoot": "apps/backend/fastapi",
|
||||
"projectType": "application",
|
||||
"implicitDependencies": ["alveslib"],
|
||||
"targets": {
|
||||
"dev": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "apps/backend/fastapi",
|
||||
"command": "python3.12 server.py"
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": "python3.12 -m compileall apps/backend/fastapi"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": ".venv/bin/ruff check apps/backend/fastapi"
|
||||
}
|
||||
},
|
||||
"typecheck": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": ".venv/bin/mypy apps/backend/fastapi"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": ".venv/bin/pytest apps/backend/fastapi -v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
apps/backend/fastapi/server.py
Normal file
24
apps/backend/fastapi/server.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
import uvicorn
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
@app.get("/health")
|
||||
async def health():
|
||||
return {"status": "healthy"}
|
||||
|
||||
if __name__ == "__main__":
|
||||
PORT=int(os.getenv("BACKEND_PORT", 5000))
|
||||
uvicorn.run("server:app", host="0.0.0.0", port=PORT, reload=True)
|
||||
40
apps/backend/flask/project.json
Normal file
40
apps/backend/flask/project.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "backend-flask",
|
||||
"root": "apps/backend/flask",
|
||||
"sourceRoot": "apps/backend/flask",
|
||||
"projectType": "application",
|
||||
"implicitDependencies": ["alveslib"],
|
||||
"targets": {
|
||||
"dev": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "apps/backend/flask",
|
||||
"command": "python3.12 server.py"
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": "python3.12 -m compileall apps/backend/flask"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": ".venv/bin/ruff check apps/backend/flask"
|
||||
}
|
||||
},
|
||||
"typecheck": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": ".venv/bin/mypy apps/backend/flask"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": ".venv/bin/pytest apps/backend/flask -v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
apps/backend/flask/server.py
Normal file
17
apps/backend/flask/server.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from flask import Flask
|
||||
from flask_cors import CORS
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app, origins="*")
|
||||
|
||||
@app.route('/health')
|
||||
def health():
|
||||
return {'status': 'healthy'}, 200
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
PORT=int(os.getenv("BACKEND_PORT", 5000))
|
||||
app.run(host='0.0.0.0', port=PORT, debug=True)
|
||||
Reference in New Issue
Block a user