(status: number, obj: any)
| 27 | }, |
| 28 | ): Promise<RouteResult> { |
| 29 | const json = (status: number, obj: any): RouteResult => ({ status, body: JSON.stringify(obj), contentType: 'application/json' }); |
| 30 | if (!opts.tokenOk) return json(401, { ok: false, message: 'Unauthorized — missing or bad token.' }); |
| 31 | |
| 32 | if (opts.method === 'GET' && (opts.pathname === '/' || opts.pathname === '')) { |