
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
gulp-develop-server
Advanced tools
run node.js server and automatically restart for your development.
run your node.js server and automatically restart with gulp.
gulp-develop-server is a development assistant for node.js server that runs the process and automatically restarts it when a file is modified.
npm install gulp-develop-server --save-dev
var gulp = require( 'gulp' ),
server = require( 'gulp-develop-server' );
// run server
gulp.task( 'server:start', function() {
server.listen( { path: './app.js' } );
});
// restart server if app.js changed
gulp.task( 'server:restart', function() {
gulp.watch( [ './app.js' ], server.restart );
});
###server.listen( options[, callback] )
options {Object}
path
'./your_node_app.js'
env
{ NODE_ENV: 'development' }
(extends current process.env
){ PORT: 3000, NODE_ENV: 'production' }
args
execArgv
[ '--harmony' ]
delay
600
options.delay
seconds,
assumes the server listening success.0
, it will only check successMessage
.successMessage
/^[Ss]erver listening/
process.send
method,
this plugin assumes the server listening success.errorMessage
/[Ee]rror:/
killSignal
SIGTERM
callback( error )
###server.restart( [callback] ) / server.changed( [callback] )
callback( error )
###server( [options] )
Create a Transform
stream.
Restart the server at once when this stream gets files.
###server.kill( [signal, callback] )
Send kill signal to the server process.
signal {String}
callback( error )
###server.reset( [signal, callback] )
Send kill signal to the server process and reset the options to default.
signal {String}
callback( error )
####with gulp-livereload:
var gulp = require( 'gulp' ),
server = require( 'gulp-develop-server' ),
livereload = require( 'gulp-livereload' );
var options = {
path: './apps/app.js'
};
var serverFiles = [
'./apps/app.js',
'./routes/*.js'
];
gulp.task( 'server:start', function() {
server.listen( options, livereload.listen );
});
// If server scripts change, restart the server and then livereload.
gulp.task( 'default', [ 'server:start' ], function() {
function restart( file ) {
server.changed( function( error ) {
if( ! error ) livereload.changed( file.path );
});
}
gulp.watch( serverFiles ).on( 'change', restart );
});
####with BrowserSync:
var gulp = require( 'gulp' ),
server = require( 'gulp-develop-server' ),
bs = require( 'browser-sync' );
var options = {
server: {
path: './apps/app.js',
execArgv: [ '--harmony' ]
},
bs: {
proxy: 'http://localhost:3000'
}
};
var serverFiles = [
'./apps/app.js',
'./routes/*.js'
];
gulp.task( 'server:start', function() {
server.listen( options.server, function( error ) {
if( ! error ) bs( options.bs );
});
});
// If server scripts change, restart the server and then browser-reload.
gulp.task( 'server:restart', function() {
server.restart( function( error ) {
if( ! error ) bs.reload();
});
});
gulp.task( 'default', [ 'server:start' ], function() {
gulp.watch( serverFiles, [ 'server:restart' ] )
});
####use as a stream:
var gulp = require( 'gulp' ),
server = require( 'gulp-develop-server' ),
bs = require( 'browser-sync' ),
coffee = require( 'gulp-coffee' );
var options = {
server: {
path: './apps/app.js',
execArgv: [ '--harmony' ]
},
bs: {
proxy: 'http://localhost:3000'
}
};
var serverCoffee = [
'./src/*.coffee'
];
gulp.task( 'server:start', function() {
server.listen( options.server, function( error ) {
if( ! error ) bs( options.bs );
});
});
// If server side's coffee files change, compile these files,
// restart the server and then browser-reload.
gulp.task( 'server:restart', function() {
gulp.src( serverCoffee )
.pipe( coffee() )
.pipe( gulp.dest( './apps' ) )
.pipe( server() )
.pipe( bs.reload({ stream: true }) );
});
gulp.task( 'default', [ 'server:start' ], function() {
gulp.watch( serverCoffee, [ 'server:restart' ] );
});
FAQs
run node.js server and automatically restart for your development.
The npm package gulp-develop-server receives a total of 529 weekly downloads. As such, gulp-develop-server popularity was classified as not popular.
We found that gulp-develop-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.