The URL a controller's `index` answers at, or null for a file that isn't one.
(filePath: string)
| 87 | |
| 88 | /** The URL a controller's `index` answers at, or null for a file that isn't one. */ |
| 89 | function controllerUrl(filePath: string): string | null { |
| 90 | const m = CONTROLLER_FILE.exec(filePath); |
| 91 | if (!m) return null; |
| 92 | const segments = m[2]!.toLowerCase().split('/'); |
| 93 | const module = m[1]?.toLowerCase(); |
| 94 | if (!module) return `/${segments.join('/')}`; |
| 95 | return segments.length === 1 && segments[0] === module ? `/${module}` : `/${[module, ...segments].join('/')}`; |
| 96 | } |
| 97 | |
| 98 | function routeNode(filePath: string, line: number, verb: string, routePath: string, now: number): Node { |
| 99 | return { |
no test coverage detected