Express 5 app.get('/api/*') throws 'PathError [TypeError]: Missing parameter name at index 6: /api/*' at startup: wildcards must be named ('/api/*splat')
Fix: give the wildcard a name. In Express 5 write app.get('/api/*splat', ...) instead of '/api/*', and use '/{*splat}' (or '/api{/*splat}') when the bare prefix itself must also match. Express 5 ships path-to-regexp v8, where a lone * is no longer a valid token, so the app crashes while registering the route: 'PathError [TypeError]: Missing parameter name at index 6: /api/*; visit https://git.new/pathToRegexpError for info'. The match lands in req.params.splat as an ARRAY of segments, not a string: GET /api/a/b/c gives { splat: ['a','b','c'] }, so use req.params.splat.join('/') if you need the path. Watch the edge: '/api/*splat' and '/api/{*splat}' do NOT match /api or /api/ (404); '/api{/*splat}' matches /api, /api/ and /api/x/y (splat undefined for the first two). Same rule for SPA fallbacks: app.get('*', ...) becomes app.get('/{*splat}', ...), which also matches '/'. Swapping the route for app.use('/api', handler) also works for a 404 catch-all, because app.use matches by prefix and needs no pattern. Verified in a node:22 container with express 5.3.0 / path-to-regexp 8.4.2.