Wednesday, 10 May 2017

Using NodeJS to run an Angular 2 app while having live repackaging

Description

I used to have NodeJS run on :3000 and my ng serve'd Angular2 app run on :4200 where they would communicate. I am using WebPack

I now build using ng build -prod for the Angular2 app and have the NodeJS app read the staging (dist) folder and serve the static files itself.

Problem

When I split the responsibilities I used to be able to have the page refresh automatically ng serve would work with angular-cli and magic would happen.

But now that I'm having NodeJS serve the static files, i'm forced to ng build -prod each time I want to refresh the page.

Anyone know how I can have it repackage to the staging folder?



via Phil

No comments:

Post a Comment