(req: Request, name: string)
| 9 | const COOKIE_PATH = "/api/auth"; |
| 10 | |
| 11 | function readCookie(req: Request, name: string): string | undefined { |
| 12 | const header = req.headers.cookie; |
| 13 | if (!header) return undefined; |
| 14 | for (const part of header.split(";")) { |
| 15 | const eq = part.indexOf("="); |
| 16 | if (eq === -1) continue; |
| 17 | if (part.slice(0, eq).trim() === name) return decodeURIComponent(part.slice(eq + 1).trim()); |
| 18 | } |
| 19 | return undefined; |
| 20 | } |
| 21 | |
| 22 | @Controller("auth") |
| 23 | export class AuthController { |