When I use Express.js and Angular? (using Node.js)

1
Hello, good evening guys, I started to study Node.JS about 2 weeks ago, and I am in doubt about these 2 frameworks, because in the video lessons I was initially seeing about Node.Js, the boy only used Express as Framework. But everywhere I look I always fall into the Angular.

So I went to study the Angular and I came to the conclusion that it is a tool that divides the web page into modules to facilitate the organization of html and css and javascript, and this confused me even more because express.js does exactly the same thing, and yet there are people who use the 2 in the same project saying that the expression is for server side, and the angle for client side, but in my view it's exactly the same thing.

If anyone can conceptually explain to me where each one goes on a project, I would be very happy, because I'm already more lost than deaf in bingo, thank you.

    
asked by anonymous 14.10.2017 / 06:54

1 answer

0
  • Node.Js was created from the interpretation engine of scripts from Chrome (v8) . Roughly it is a javascript script executor without the need of browser and no docking in the DOM. It is widely used as a web server in cases where many calculations are not necessary, but it has a lot of data flow (streams).

  • Express is the framework that assists in web page request / response routing and tasks
  • Angular is a javascript framework for editing and updating html using SPA (Single page application), which allows you to organize things quite a lot in reusable modules and perform various tasks to focus more on our program code.

After deploy it is like a set of libraries next to our program and needs an engine for interpretation like the browser.

Using angular (client side) you will only have one page index.html and the other components will be used as a template to plug in parts of the screen. There is no postback, the data is exchanged in Json in the background with XMLHttpRequest and the angular will take care of the change detection and redraw of the required HTML snippet in the DOM.

The angle can even be used on both client and server side by sharing the same code (concept of isomorphic ). In this case, the server pre-renders the html of the requested page, returning to the browser to display faster on the screen until the angular loads all its bundles. In the next action of the screen after the angular load there will be no postback, just search Json on the server to reshape the screen. This is useful for both display speed on slow connections and search engine rankings.

    
16.10.2017 / 01:47