project init

This commit is contained in:
2024-09-10 16:04:15 -05:00
commit 0f71fc4459
4 changed files with 26 additions and 0 deletions

4
README.md Normal file
View File

@@ -0,0 +1,4 @@
# linkpulse
This is an empty project right now. It merely holds a simplistic FastAPI server to showcase Railway.

11
main.py Normal file
View File

@@ -0,0 +1,11 @@
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}

9
railway.json Normal file
View File

@@ -0,0 +1,9 @@
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "hypercorn main:app --bind \"[::]:$PORT\""
}
}

2
requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
fastapi==0.100.0
hypercorn==0.14.4