Categories
angular angular5 express node.js

How run in same port Angular and Node.JS Express?

This is might be possible to duplicate question but not able to understand how to configure FE and BE together run them both.

I’ve gone through this and this questions, but couldn’t understand.

My Node+Express running on 4300

app.post('/postData', function(req, res) {
//some worst logics here :)
});

And

Angular 5 running on 4200. Below is my FE service that calling post endpoint

postData(feData) {
console.log(feData);
this.http.post('/postData', feData, this.httpHeader).subscribe((data) => {
});
}

What I tried is opened two cmd Windows: one to run server.js by node server.js and another one with ng serve.

Result:

404 not fount(cannot post)

What am I doing wrong.