I think you are confused between front-end routing and back-end routing, please refer this . They are handled separately, and you are kind of mixing them together.
From what I understood, that you are trying to redirect the user to a 404 custom html error page you can do that like this but in front-end side (ANGULAR).
{path:"**",pathMatch:"full",redirectTo:"/home"}
Also its better to redirect them to "home" page instead of error page for better user experience. 404 custom-error page could be used for different purposes such as network failure, server down ,code break-down(Note: they are also for better user experience.)
In node.js its an endpoint and these APIs are called internally by developers, you get a request either you have the response or you don't, in case you don't you can do something like this
app.get('*', (req, res) => {
res.status(404).send('Not Found');
});
If you found this answer useful please accept it