gulp-webserver
gulp-webserver copied to clipboard
In combination with ExpressJS?
Somehow this does not work for me:
gulp.task('webserver', function() {
var webserver = require('gulp-webserver')
gulp.src(settings.server.paths.src)
.pipe(webserver({
port: settings.server.port,
https: true,
livereload: true,
directoryListing: false,
open: true
}))
})
I get a Cannot GET /
I think my ExpressJS app isn't running at all. Do I have to start my node app in a separate task, i.E. with gulp-nodemon? Probably a lame question. Just wondering how you are doing it.
This here is my current task for nodemon and might showcase my problem a bit better:
gulp.task('run', ['default', 'watch'], function() {
var nodemon = require('gulp-nodemon'),
spawn = require('child_process').spawn,
bunyan
nodemonInstance = nodemon({
script: paths.server,
ext: 'js json',
ignore: [
'etc/',
'var/',
'node_modules/',
path.relative(process.cwd(), paths.browser)
],
watch: [paths.etc, paths.src],
stdout: false,
readable: false,
quiet: true
})
.on('change', ['lint'])
.on('readable', function() {
// free memory
bunyan && bunyan.kill()
bunyan = spawn('./node_modules/bunyan/bin/bunyan', [
'--output', 'short',
'--color'
])
bunyan.stdout.pipe(process.stdout)
bunyan.stderr.pipe(process.stderr)
this.stdout.pipe(bunyan.stdin)
this.stderr.pipe(bunyan.stdin)
})
})
If I can replace the above with gulp-webserver that would be great!
Thanks for any hints or examples.