• Skip to main content
  • Skip to secondary menu
  • Skip to footer

Nikhil Mittal : My Blog

Welcome to my learning center

Ph: +91-91 7231 7321

  • Home
  • Achievements
  • Resources
  • Shop
  • Checkout
  • My account
  • Cart
  • Contact Us

Deploy Angular 7 App to GitHub

November 5, 2020 by admin

Article By: Nikhil Mittal

Angular 7 Code is running in Visual Studio Code

Web API and SQL Server are the Service & DB Layer

Step 1:

git remote add origin https://github.com/USERNAME/REPOSITORY_NAME.git

Check above:

Git remote –v

Above path should be present in output as fetch and push

Step 2:

npm install -g angular-cli-ghpages

Step 3:

In your routes configuration add

RouterModule.forRoot(routes, {useHash: true});

In your index.html do this;

<!– <base href=”/”> –>

<script>document.write(‘<base href=”‘ + document.location + ‘” />’);</script>

Step 4:

Edit the Output variable in config: dist/Project_Name to dist

Step 5:

ng build –prod –base-href ./

Step 6:

ngh –no-silent –email=<GitHub_RegisteredEmail> –name=<GitHub_UserName>

Step 7: (For Version Control Add Project into master)

git init

git add README.md

git commit -m “first commit”

git remote add origin https://github.com/<GitHub_UserName>/<RepositoryName>.git

git push -u origin master

Now you can browse your repository as well as website in Github pages

Step 8: <To Add Custom Domain>

Go to Repository settings

Enter Custom Domain URL > Save

Remove Enforce Https option

Change A and CNAME in your personal domain

The DNS propagation might take 48 Hrs. to reflect the website from GitHub Pages

Step 9:

Create another sub domain Say: apis.domainname.com in windows hosting

Host your Web API here and make sure the same API Path is included in Angular App before you start

with Step 1.

Step 10:

Bingo!!

All Done

Filed Under: Uncategorized

Footer

Nikhil Mittal

BBA(CAM), MCA, Professional Coach

  • Facebook
  • Instagram
  • LinkedIn
  • YouTube

Copyright © 2021 · Nikhil Mittal