Mode2Test AuthAndToken component complete: login/logout working, token persistence, background refresh active, tested and verified

This commit is contained in:
2026-01-17 15:31:44 +00:00
parent 319289cfac
commit eed8552282
13 changed files with 626 additions and 3 deletions
+43
View File
@@ -0,0 +1,43 @@
import { Hono } from 'hono';
import { serveStatic } from 'hono/bun';
import { join } from 'path';
import { initializeTokenService, startBackgroundRefresh } from './token-service';
import { createAuthRoutes } from './auth-routes';
// PERMANENT: Initialize token service and start background refresh
// Loads existing tokens from file if available
// Starts 5-minute background refresh cycle
initializeTokenService();
startBackgroundRefresh();
// Create Hono app
const app = new Hono();
// Mount auth routes
app.route('/api/auth', createAuthRoutes());
// Health check endpoint
app.get('/health', (c) => {
return c.text('OK');
});
// Version endpoint
app.get('/version', (c) => {
return c.json({ version: '1.0.0-beta1' });
});
// PERMANENT: Serve static frontend files
// Serves from frontend/ directory
const publicDir = join(import.meta.dir, '../frontend');
app.use('/*', serveStatic({ root: publicDir }));
// Start server on port 3005
const port = 3005;
console.log(`Mode2Test (AuthAndToken) running on http://localhost:${port}`);
console.log(`Auth API: /api/auth/*`);
console.log(`SignIn page: /signin.html`);
export default {
fetch: app.fetch,
port,
};