3

I just migrated my application to Angular 6 + Universal. It`s great but I have 2 issues to fix. Please help me for both ones:

1- How can I run the Angular Universal app in --watch mode for developing time? Before that I opened 2 terminal. In one of them I wrote command: nodemon server.js and in another on : ng build --watch. In this situation I was developing my application fast by real-time editing.

But now after each edit I use command npm run build:ssr. I takes lots of time. There should be another way for increase developing time in Angular Universal?!

2- The other issue is before I migrate to Angular Universal, I was using express to for server side same as now. I have called an API handler file like this:

const api = require('./routes/api');
app.use('/api', api);

How can I do this in new angular universal package like before in server.ts file?

1
  • 1 . There is no watch mode still available with angular universal 2. you can import by import api from './routes/api and use the app.use('/api',api); Commented Jul 26, 2018 at 8:23

1 Answer 1

1

For Angular7 run npm run ssr:watch

package.json

    "ssr:watch": "run-p ssr:universal:build:*",
    "ssr:universal:build:browser": "ng run universal-demo:build --watch",
    "ssr:universal:build:server": "node ./node_modules/npm-delay 12000 && ng run universal-demo:server --watch",
    "ssr:universal:build:webpack": "node ./node_modules/npm-delay 20000 && webpack --config webpack.config.js --watch",
    "ssr:universal:build:nodemon": "node ./node_modules/npm-delay 25000 && nodemon --inspect server.js",
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.