I am building my angular project and inserting the build output into a public folder in the root of my node project.
In my app.js file, I have the following code:
...
app.use(express.static(path.join(__dirname, 'public')));
...
app.get('*', (req, res) => {
res.send(path.join(__dirname, 'public/index.html'));
});
When deploying the project, this works perfectly; when I load the page, the index.html is rendered and navigating through the page works.
However, when I enter a url like for example '/admin', which is defined in my angular routing, I get a not found error.
How can this be solved?