J
J
jspie2017-08-16 14:01:16
JavaScript
jspie, 2017-08-16 14:01:16

What are the interaction methods between Angular 2 and Express?

Hello, I created a server on NodeJs, express. Everything is stored in the server folder (server/app.js) , then I created a folder and an application in Angular (ng new client). How can you link them?
On react, I did a bunch through webpack and webpack-dev-middleware. After starting the server, the client itself was launched and interacted with the api. With angular how to do this correctly? I'm a beginner, don't scold me much, I googled and they do it differently everywhere, I even prescribed statics but nothing ..
5d8aa200110d468d911191a2286f6015.png
af23a674bac740ca919d2854bafff7fc.png
4f9e458694214068959e7e3f90d669e8.png
app.js

app.use(express.static(path.join(__dirname, '/../client/src')));

A window opens and the inscription "Loading ..."
If you run ng server in a separate terminal, the site will work. Do I need to run the server and client separately on different ports?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question