(req: Request, env: Env)
| 17 | |
| 18 | export default { |
| 19 | async fetch(req: Request, env: Env): Promise<Response> { |
| 20 | const url = new URL(req.url) |
| 21 | |
| 22 | if (req.method === 'GET') { |
| 23 | return handleGet(url, env) |
| 24 | } |
| 25 | if (url.pathname === '/upload' && req.method === 'POST') { |
| 26 | return handleUpload(req, env, url) |
| 27 | } |
| 28 | return json({ error: 'not_found' }, 404) |
| 29 | }, |
| 30 | } satisfies ExportedHandler<Env> |
| 31 | |
| 32 | // GET /7d/<id>.html 或 /30d/<id>.html —— 从 R2 读,返回 text/html |
no test coverage detected