DDapp Hello World - Running code sample and change system environment parameters
In previous post, we've already created our sample project, now time to start viewing what will be displayed when running this project. Let's jumped.
Running the first
Be sure that project is still opened in code editor, press combo key Shift + ~ (the button next to 1 button on your keyboard). It's bring in-line command line like this.
Let move to the project folder by typing this:
cd .\first-angular-ddapp\
Its result should be like this
first-angular-ddapp>
Now, time to enter what you want to in-line command line. Let's start with the most thing we want to see now: The result of project was created. Let's type:
ng serve
If the result as following displayed in the in-line command line, congratulation you've been in love with angular.
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-06-06T03:47:28.202Z
Hash: 8a73b8811ca32d34a146
Time: 9079ms
chunk {inline} inline.bundle.js (inline) 3.85 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 18 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 555 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 41.5 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 7.43 MB [initial] [rendered]
webpack: Compiled successfully.
Now, let's open your favorite web browser and enter following address.
http://localhost:4200
Press Enter and see the magic things :D
Wait, why is its port 4200, why not another port ? Be patient, let's go next step.
Changing system environment - the app running port
By default, port 4200 will be used to expose what our angular app provide. You can easily change this port by adding more parameters to ng serve command like this.
ng serve --port 6969
By changing the startup port, you can integrate your angular app into server engine like Nginx to broadcast your website and system. I'm going to write a small tutorial about configuration a VPS with NodeJS, Nginx reserve proxy and Angular App.
Conclusion
You've known that how to run your angular app, change the startup port. From now, every phase related to *Run your application*, *Change your port*, you should know where to do it.
Let's go back to the main art to see what's next steps.