angular / universal-starter

Angular Universal starter kit by @AngularClass
2.02k stars 688 forks source link

Development with API-Routes is unoptimized #580

Open Vetm opened 6 years ago

Vetm commented 6 years ago

I'm experiencing similar problems as #518. The current solution for developing with API-routes is not very pleasant.

The server.ts has an example for using API-routes. However, in order to use this you'll have to do a complete production build everytime you change your code as ng serve doesn't start the express server.

To achieve a more comfortable solution you could probably create an npm script that uses the --watch param for ng build/webpack in some way. Unfortunately I did not find a working solution to make this work.

Is there any way right now to have an ng serve-like experience while using API-routes?

Toxicable commented 6 years ago

We understand developing agasint Universal is painful right now. We also have some tooling in the pipeline that'll help in this situation, but it's very much still early stages so we're not 100% how it's going work out just yet.

Right now you could use ng build --watch for the frontend and then use watch (npm module) to rebuild / restart your Nodejs app when your /dist changes. However, this will be a very slow process and i'd suggest jsut develpoping with ng serve then doing occasional checks agasint Universal.