Create a project in Angular

  • Type following command to create a new project:
    # ng new <PROJECT-NAME>

It will ask “Would you like to add Angular routing? (y/N)” – Type y and hit Enter
On the next step, it will ask “Which stylesheet format would you like to use?” – Select the relevant one, I suggest using CSS.

  • To build your app and serve it locally, go to the newly created project folder and use the following command:
    # ng serve
  • To build and open the project directly in the browser, use the following command:
    # ng serve -o

You will see the message “Compiled successfully”
You can see default port no:4200

  • You will be able to access the new angular project locally using the URL: http://localhost:4200/.
  • Once you open this URL, you will see the default homepage.

Run project in Forever using PM2

Install PM2 first on the server using the following command:
# npm install -g pm2

Run the following command to run your project in forever using PM2
# pm2 start “ng serve” –name <PROJECT-NAME>