In Express 4 and earlier, app.all('*') acted as a catch-all route for all requests without the need to name the wildcard. However, in Express 5, it seems that the unnamed wildcard is no longer allowed and must be named.
app.get('/', (req: Request, res: Response) => {
res.send('Hello World!');
});
app.all('/*splat', (req: Request, res: Response) => {
res.status(404).json({
message: `The URL ${req.originalUrl} doesn't exist`
});
});