Create an Angular App That Builds and Deploys with ZEIT Now

Deploy your Angular app with ZEIT Now.

Angular is a popular JavaScript framework for building apps across all platforms; web, mobile web, native mobile, and native desktop.

In this guide, we will deploy an Angular app with ZEIT Now like the following: https://tour-of-heroes-he3j9k80n.now.sh/

Step 1: Set Up Your Angular Project

The most straightforward way to set up an Angular project is to use the official Angular CLI tool. The CLI tool interactively generates an Angular app that works out of the box.

If you don't have the Angular CLI installed globally, use the following command to install it:

npm i -g @angular/cli

Installing Angular CLI global to the system user with npm.

Once the installation is complete, run the following command in your terminal to create a new Angular app:

ng new my-new-app

Creating a new Angular app within a terminal.

Once you run the command, the Angular CLI presents the following options:

  • Adding Angular Routing to the project.
  • The Stylesheet format to add to the project: css, sass, less, stylus.

For the first option, if you choose Yes, the CLI tool adds routing automatically to the project. Then, you can select your preferred stylesheet format for the second option. Once selected, Angular CLI provides the selected stylesheet format for the project.

After a successful scaffolding, cd into my-new-app directory and run the following command to serve your app in the browser:

ng serve --open

Running your Angular app locally

Your browser will automatically be launched with the served Angular app at http://localhost:4200/

Step 2: Deploy Your Angular Project with Now

With your Angular app set up, it is ready to deploy live with Now.

If you have not yet installed Now, you can do so by installing Now CLI.

With Now installed, you can deploy your Angular project with a single command.

now

Deploying the app with the now command.

If you want your app to deploy automatically, you can install either the Now for GitHub or Now for GitLab apps, this will provide you with unique deployments for your Git repository on every push.

When your app is deployed, you will receive a deployment URL similar to the one shown at the beginning of this guide: https://tour-of-heroes-he3j9k80n.now.sh/

Note: We used the official Angular Tour of Heroes tutorial app for the deployment. Download, extract and follow this guide to deploy.


Written By
Written by unicodeveloperunicodeveloper
on February 27th 2019