Asking for a gulpfile.js file

  node.js, question

I didn’t bother to refresh my browser, so I tossed about gulp.

I am using a web project initiated by express

With gulp-live-server, you can only modify views/, public/The file under can take effect (static file)
The file modification under routes will not take effect. The file is as follows:

var gulp = require('gulp');
 
 gulp.task('default', function() {
 
 var gls = require('gulp-live-server');
 //1. run your script as a server
 var server = gls.new('bin/www');
 server.start();
 
 //use gulp.watch to trigger server actions(notify, start or stop)
 gulp.watch(['public/**/*.*', 'views/**/*.html'], function(file) {
 server.notify.apply(server, [file]);
 });
 
 gulp.watch(['routes/**/*.js'], function(file) {
 server.start.bind(server, [file]);  //restart my server
 });
 });

I’d like to ask the great god to admire a gulpfile.js file only for the project initiated by express.
Thank you here!

The main effect is not onlystatic fileModified the browser automatic refresh, but alsoServer jsChanges can also be automatically refreshed, right

Try the following gulp configuration

'use strict';
 
 var gulp = require('gulp');
 var browserSync = require('browser-sync');
 var nodemon = require('gulp-nodemon');
 
 
 gulp.task('default', ['browser-sync'], function () {
 });
 
 gulp.task('browser-sync', ['nodemon'], function() {
 browserSync.init(null, {
 Proxy: "http://localhost: 5000"//the service port you open in express is usually 3000
 files: ["public/**/*.*"],
 browser: "google chrome",
 port: 7000,
 });
 });
 gulp.task('nodemon', function (cb) {
 
 var started = false;
 
 return nodemon({
 script: 'app.js'
 }).on('start', function () {
 // to avoid nodemon being started multiple times
 // thanks @matthisk
 if (!  started) {
 cb();
 started = true;
 bracket
 });
 });