`/api` + `/users` → `/api/users`; `/api/` + `/` → `/api`.
(prefix: string, path: string)
| 605 | |
| 606 | /** `/api` + `/users` → `/api/users`; `/api/` + `/` → `/api`. */ |
| 607 | function joinPaths(prefix: string, path: string): string { |
| 608 | const a = prefix.replace(/\/+$/, ''); |
| 609 | const b = path.replace(/^\/+/, ''); |
| 610 | const joined = b ? `${a}/${b}` : a; |
| 611 | return joined === '' ? '/' : joined; |
| 612 | } |
| 613 | |
| 614 | /** |
| 615 | * The file a mount's last argument names: an inline `require('./x')`, an |