Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting Angular2 on Heroku

I am having trouble finding a tutorial on how to host an angular2 application (hopefully with Typescript) on Heroku or any other hosting provider for that matter.

Ideally, I'd like to find a way to run this repo on Heroku but guidance on any angular2/typescript repo on Heroku would be helpful: https://github.com/auth0/angular2-authentication-sample

Any guidance or advise you can offer would be greatly appreciated

like image 968
Benjamin McFerren Avatar asked Feb 16 '16 05:02

Benjamin McFerren


People also ask

Can Heroku host Angular?

For that question, you should answer “yes” to enable Angular routing. After the CLI completes its process, you will have a fully operating Angular application. You can test it out by stepping into the project directory cd angular-app-in-heroku and then running ng serve .


2 Answers

You will need server app/framework for that.

This repository contains files from Express generator app and Quick-start Angular 2 app.

  • Git: https://github.com/vladotesanovic/angular2-express-slim
  • Heroku demo: https://express-angular2-slim.herokuapp.com/

I have one other example that is also ready for Heroku: express + angular 2 + Procfile ( needed by the Heroku ) + other libraries

  • Git: https://github.com/vladotesanovic/angular2-express-starter
  • Heroku demo: https://github.com/vladotesanovic/angular2-express-starter

You need an account on Heroku. Push this code as-is ( in both cases ).


Official repo from Angular2 ( server side rendering ) on Express: https://github.com/angular/universal-starter

like image 162
Vlado Tesanovic Avatar answered Oct 16 '22 18:10

Vlado Tesanovic


If you use Heroku's Node buildpack, I believe you should be fine. I was able to deploy the Angular 2 seed project to Heroku this way.

If you want to deploy a real, full-blown web application using Angular 2, you will almost certainly need some sort of persistence layer, like Vlado mentioned.

If you're interested in deploying Angular 2 to Heroku with Rails, here's a tutorial for that. https://www.angularonrails.com/deploy-angular-2rails-5-app-heroku/

like image 44
Jason Swett Avatar answered Oct 16 '22 19:10

Jason Swett