Separate into /backend and /frontend folders

This commit is contained in:
2024-10-15 23:27:31 -05:00
parent fd5a5125d3
commit 5b28c69163
6 changed files with 27 additions and 2 deletions

19
backend/linkpulse/main.py Normal file
View File

@@ -0,0 +1,19 @@
from fastapi import FastAPI, Request
from datetime import datetime
app = FastAPI()
@app.get("/")
async def get_current_time(request: Request):
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
user_ip = request.headers.get("X-Forwarded-For")
return {"time": current_time, "ip": user_ip}
if __name__ == "__main__":
import asyncio
from hypercorn.config import Config
from hypercorn.asyncio import serve
asyncio.run(serve(app, Config()))