Compare commits

1 Commits

Author SHA1 Message Date
Agent 203518ac66 Final push: Correct directory structure and content 2026-05-17 10:04:27 +00:00
5 changed files with 36 additions and 9 deletions
+7
View File
@@ -0,0 +1,7 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, declarative_base
SQLALCHEMY_DATABASE_URL = "postgresql://user:pass@db:5432/notes"
engine = create_engine(SQLALCHEMY_DATABASE_URL)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
+12
View File
@@ -0,0 +1,12 @@
version: "3.8"
services:
app:
build: .
ports: ["8000:8000"]
depends_on: [db]
db:
image: postgres:13
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: notes
+1
View File
@@ -0,0 +1 @@
<!DOCTYPE html><html><head><script src="https://cdn.tailwindcss.com"></script></head><body class="bg-yellow-50 p-10"><h1 class="text-2xl font-bold">旅行地のノート</h1></body></html>
+9 -9
View File
@@ -1,13 +1,13 @@
from fastapi import FastAPI, Request
from datetime import datetime, timezone
from fastapi.responses import HTMLResponse
import uvicorn
app = FastAPI()
@app.get("/")
async def read_root(request: Request):
client_host = request.client.host
return {
"message": "ハローワールド!!",
"client_ip": client_host,
"current_time_utc": datetime.now(timezone.utc).isoformat()
}
@app.get("/", response_class=HTMLResponse)
def read_root():
with open("index.html", "r") as f:
return f.read()
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
+7
View File
@@ -0,0 +1,7 @@
from sqlalchemy import Column, Integer, String
from database import Base
class Note(Base):
__tablename__ = "notes"
id = Column(Integer, primary_key=True, index=True)
content = Column(String)