Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Building and Deploying Angular Applications

Local Development

You may wish to test your app locally. Assume your Angular app is named your-angular-app. Therefore, the folder containing your app is named your-angular-app. This is your project root directory.

  1. Go to your Angular app directory, using a terminal
     cd your-angular-app
  2. Start the development server, using the following command
     ng serve

    This command will compiles and builds all files, and then starts the server.

  3. To access the app, open a web browser, enter a URL

    Note: Node.js server runs on port 4200, by default.

  4. To shutdown the server, go to the terminal where ng serve is running, and press keyboard Ctrl+c

Server Deployment

To deploy, you should build your app for production.

  1. Go to your Angular app directory, using a terminal
     cd your-angular-app
  2. Run the following command to make your app production ready
     ng build

    This will create a dist folder in your project root directory. The dist folder contains a your-angular-app folder; the your-angular-app folder should basically contain the following files

  3. Upload those files to the server in the directory you choose.
  4. Optional: If you get errors, you may need to update the <base> in index.html depending on the server config. For our cs4640 server, update this to:
     <base href=".">