N
N
Nick Nesterov2016-03-09 12:25:21
Angular
Nick Nesterov, 2016-03-09 12:25:21

How to run frontend and backend on gulp with livereload at the same time?

Good day to all.
I write full stack, Angular frontend, Express backend. Everything is standard)))
How can I connect any of the plugins:
gulp-connect, gulp-nodemon, gulp-webserver, browsersync
so that the frontend and backend are on the same port and livereload works?
I connect the frontend via:
app.use(express.static('./client'));
and start the server via nodemon:

return nodemon({
    script: './server/app.js'
  })

But then the livereload of the frontend does not work.
Who sets up gulp in full stack?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pomeo, 2016-03-09
@njnesterov

Nodemon you run with nodemon server/app.js --watch server
browsersync run inside gulpfile with proxy which indicates that above nodemon will run
in gulp task default gulp.watch(['client/*'], browserSync.reload) ;
Should work

K
Konstantin Kitmanov, 2016-03-09
@k12th

There seems to be a livereload middleware for express. But, to be honest, I was always too lazy to figure it out and I just ran gulp watch in one tab, and nodemon app.js in another (tmux is our everything). In production, the static is only collected, so gulp watch is not needed there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question