barebones docker | pocketbase | hono | svelte

This commit is contained in:
JCEEE
2026-06-23 21:49:54 +01:00
parent 2253b54077
commit f9d9fa9ace
105 changed files with 27341 additions and 97 deletions
+35
View File
@@ -0,0 +1,35 @@
import { serve } from '@hono/node-server';
import { Hono } from 'hono';
const PB_URL = process.env.PB_URL || 'http://127.0.0.1:8090';
const PB_EMAIL = process.env.PB_SUPERUSER_EMAIL || '';
const PB_PASSWORD = process.env.PB_SUPERUSER_PASSWORD || '';
const DEBUG_RECORD_ID = process.env.DEBUG_RECORD_ID || '';
const app = new Hono();
app.get('/api/health', (c) => c.json({ status: 'ok' }));
app.post('/api/debug/increment-hono', async (c) => {
const auth = await fetch(`${PB_URL}/api/collections/_superusers/auth-with-password`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ identity: PB_EMAIL, password: PB_PASSWORD })
});
const { token } = await auth.json();
const record = await fetch(`${PB_URL}/api/collections/debug/records/${DEBUG_RECORD_ID}`, {
headers: { Authorization: `Bearer ${token}` }
});
const data = await record.json();
const current = data.hono_count || 0;
await fetch(`${PB_URL}/api/collections/debug/records/${DEBUG_RECORD_ID}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
},
body: JSON.stringify({ hono_count: current + 1 })
});
return c.json({ ok: true });
});
const port = parseInt(process.env.PROXY_PORT || '3456', 10);
serve({ fetch: app.fetch, port }, (info) => {
console.log(`Hono proxy listening on http://localhost:${info.port}`);
});
//# sourceMappingURL=index.js.map