i am serving my Angular 7 project at nodejs server , on page refresh i get error Cannot GET /profile for example .
i have read that i need to add this code to allow server to load routs on refresh , and it worked but another issue showed up that my node Post or Get rquests stoped working because any route will always redirect to my main domain for example www.domain.com/api/profile will redirect to www.domain.com and the request function will not fire . any idea what to do?
note: if i remove the below code , request will work but refresh issue will show up .
app.get('*', function (req, res){
res.sendFile(path.join(__dirname+'/build/dist/index.html'));
});