fix route mounting, db socket parsing, dev proxy rewrite, use port 3003

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 15:51:31 +01:00
parent 53b4ad5d7f
commit 478ab57ef3
5 changed files with 14 additions and 5 deletions

View File

@@ -1,2 +1,2 @@
DATABASE_URL=postgresql://serve:yourpassword@localhost:5433/movie_select?host=/home/serve/tmp
PORT=3001
PORT=3003

View File

@@ -6,7 +6,7 @@ set -euo pipefail
REMOTE_HOST="serve"
REMOTE_APP_DIR="/home/serve/services/movie-select"
REMOTE_STATIC_DIR="/var/www/virtual/serve/html/movie-select"
REMOTE_PORT=3001
REMOTE_PORT=3003
DB_NAME="movie_select"
PG_SOCKET_DIR="/home/serve/tmp"
PG_PORT=5433

View File

@@ -7,7 +7,7 @@ const app = new Hono();
app.use("*", cors());
app.route("/api/rounds", roundsRouter);
app.route("/rounds", roundsRouter);
app.onError((err, c) => {
if (err instanceof ApiError) {

View File

@@ -3,6 +3,15 @@ import postgres from "postgres";
import { env } from "../lib/env.ts";
import * as schema from "./schema/index.ts";
const client = postgres(env.DATABASE_URL);
const url = new URL(env.DATABASE_URL);
const socketHost = url.searchParams.get("host");
const client = postgres({
host: socketHost ?? url.hostname,
port: Number(url.port) || 5432,
database: url.pathname.slice(1),
username: url.username,
password: url.password,
});
export const db = drizzle(client, { schema });

View File

@@ -12,7 +12,7 @@ export default defineConfig({
proxy: {
"/movie-select/api": {
target: "http://localhost:3001",
rewrite: (path) => path.replace(/^\/movie-select/, ""),
rewrite: (path) => path.replace(/^\/movie-select\/api/, ""),
},
},
},