mirror of
https://github.com/Xevion/linkpulse.git
synced 2025-12-11 00:07:45 -06:00
Separate into /backend and /frontend folders
This commit is contained in:
19
backend/linkpulse/main.py
Normal file
19
backend/linkpulse/main.py
Normal 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()))
|
||||
Reference in New Issue
Block a user