One can find reason for "dist" folder creation in "angular.json" file. When we run "ng build" command,then it will create a folder "dist" at root level of application and a sub folder in it with the same name of application.In side of that sub folder it places JavaScript bundles of Angular application. It is also possible to run this command in watch mode as "ng build -watch" which can rebuild the angular app automatically after modifications. The ng build command is intentionally for building the apps and deploying the build artifacts. The ng serve command is intentionally for fast, local and iterative developments and also for builds, watches and serves the application from a local CLI development server. SO first we need to create JavaScript bundles by transpiling the Angular app. We know that Angular is written in TypeScript. Now, once the HTTP server is ready ,then we can focus on connecting Angular application with this server. ![]() It is combination of multiple middlewares which can help developer to create efficient server side services of a web application.Let us create an HTTP server using "express" module.Įnter fullscreen mode Exit fullscreen mode Express is a web application framework which run on top of NodeJS. We can use either "http" module or "express" module to create a HTTP Server. But when we use NodeJS as backend technology,it allows to create HTTP server instead of using third party web servers. When we implement server side services,we can use web server/HTTP server like Apache tomcat. When we send request to live development server from browser as then it will send the JavaScript bundles of Angular application as response.That server is enough to run and test angular application. It will listen to port number 4200 by default. ![]() Open your terminal or command prompt, and run the following command: npm install -g angular/cli Verifying The Installation. When we create a new angular application using CLI tool, we will be provided with live development server to run that application. Install Node.js, and npm will join the party automatically. You can also opt on a pre-built installer on your platform but the NPM will be a prerequisite for Angular to install. In this article, i will explain ,how to connect Angular Application with Nodejs backend. Start developing on Angular by downloading the Node.js source code.
0 Comments
Leave a Reply. |