mirror of
https://github.com/saltbo/zpan.git
synced 2026-10-28 03:42:42 +08:00
Replace pnpm workspace monorepo (packages/server, packages/web, packages/shared) with a flat single-package layout following Hono's pages-stack pattern. Switch from pnpm to npm and from Workers+Assets to CF Pages Functions deployment model. - Move source: packages/server/src/ → server/, packages/web/src/ → src/, packages/shared/src/ → shared/ - Add functions/api/[[route]].ts as CF Pages Functions entry (replaces entry-cloudflare.ts) - Update 22 import paths: server uses relative, web uses @shared/@server aliases - Merge three package.json into one, switch to npm - Update wrangler.toml: remove main/assets (Pages auto-detects functions/ dir) - Add per-directory tsconfig.json for VS Code type resolution - Simplify Dockerfile for flat layout - Fix react-pdf CSS import path (dist/esm/ → dist/) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
14 lines
422 B
TypeScript
14 lines
422 B
TypeScript
import { createMiddleware } from 'hono/factory'
|
|
import type { Env } from './platform'
|
|
|
|
export const accessLog = createMiddleware<Env>(async (c, next) => {
|
|
const start = Date.now()
|
|
await next()
|
|
const ms = Date.now() - start
|
|
const { method } = c.req
|
|
const path = c.req.path
|
|
const status = c.res.status
|
|
const userId = c.get('userId') ?? '-'
|
|
console.log(`${method} ${path} ${status} ${ms}ms uid=${userId}`)
|
|
})
|