{"id":20992249,"url":"https://github.com/narirou/gulp-develop-server","last_synced_at":"2025-05-14T20:32:37.805Z","repository":{"id":18250146,"uuid":"21403953","full_name":"narirou/gulp-develop-server","owner":"narirou","description":"Development assistant for node.js server by gulp","archived":false,"fork":false,"pushed_at":"2016-10-26T08:39:34.000Z","size":101,"stargazers_count":70,"open_issues_count":5,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-09T17:38:16.822Z","etag":null,"topics":["developer-tools","express","gulp","gulp-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ShawnLinx/robotlegs1.5","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/narirou.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-01T22:15:54.000Z","updated_at":"2024-03-19T12:08:15.000Z","dependencies_parsed_at":"2022-09-14T01:32:52.813Z","dependency_job_id":null,"html_url":"https://github.com/narirou/gulp-develop-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/narirou%2Fgulp-develop-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/narirou%2Fgulp-develop-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/narirou%2Fgulp-develop-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/narirou%2Fgulp-develop-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/narirou","download_url":"https://codeload.github.com/narirou/gulp-develop-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225310090,"owners_count":17454089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["developer-tools","express","gulp","gulp-plugin"],"created_at":"2024-11-19T07:10:05.119Z","updated_at":"2024-11-19T07:10:06.855Z","avatar_url":"https://github.com/narirou.png","language":"JavaScript","readme":"gulp-develop-server\n===================\n\n\u003e run your node.js server and automatically restart with gulp.\n\n[![Build Status][travis-image]][travis-url]\n[![Dependency Status][deps-image]][deps-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n[![Npm Modules][npm-image]][npm-url]\n[![MIT Licensed][license-image]][license-url]\n\n[travis-image]: https://img.shields.io/travis/narirou/gulp-develop-server.svg?style=flat-square\n[travis-url]: https://travis-ci.org/narirou/gulp-develop-server\n[coveralls-image]: https://img.shields.io/coveralls/narirou/gulp-develop-server.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/narirou/gulp-develop-server\n[npm-image]: http://img.shields.io/npm/v/gulp-develop-server.svg?style=flat-square\n[npm-url]: https://www.npmjs.org/package/gulp-develop-server\n[deps-image]: https://img.shields.io/david/narirou/gulp-develop-server.svg?label=deps\u0026style=flat-square\n[deps-url]: https://david-dm.org/narirou/gulp-develop-server\n[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square\n[license-url]: ./LICENSE\n\ngulp-develop-server is a development assistant for node.js server that runs\nthe process and automatically restarts it when a file is modified. \n\n\n\ninstallation\n------------\n\n```bash\nnpm install gulp-develop-server --save-dev\n```\n\n\n\nusage\n-----\n\n```javascript\nvar gulp   = require( 'gulp' ),\n    server = require( 'gulp-develop-server' );\n\n// run server\ngulp.task( 'server:start', function() {\n    server.listen( { path: './app.js' } );\n});\n\n// restart server if app.js changed\ngulp.task( 'server:restart', function() {\n    gulp.watch( [ './app.js' ], server.restart );\n});\n```\n\n\n\napi\n---\n\n###server.listen( options[, callback] )\n\n**options {Object}**  \n\n- `path`  \n    - type: {String}\n    - example: `'./your_node_app.js'`\n    - Your node application path. This option is required.\n\n- `env`  \n    - type: {Object}  \n    - default: `{ NODE_ENV: 'development' }` (extends current `process.env`)  \n    - example: `{ PORT: 3000, NODE_ENV: 'production' }`  \n    - Environment settings of your server.  \n\n- `cwd`  \n    - type: {String}  \n    - default: `.`\n    - example: `path/to/my/project/`  \n    - Current working directory of the child process  \n\n- `args`\n    - type: {Array}  \n    - your application's arguments\n\n- `execArgv`  \n    - type: {Array}  \n    - example: `[ '--harmony' ]`  \n    - Run node process with this options.  \n\n- `delay`   \n    - type: {Number}  \n    - default: `600`  \n    - If this plugin does not receive an error from the server after `options.delay` seconds,\n    assumes the server listening success.\n    - This option needs to adjust according to your application's initialize time.\n    - If this option set `0`, it will only check `successMessage`.  \n\n- `successMessage`  \n    - type: {RegExp}\n    - default: `/^[Ss]erver listening/`  \n    - If your application send the specific message by `process.send` method,\n    this plugin assumes the server listening success.\n\n- `errorMessage`  \n    - type: {RegExp}\n    - default: `/[Ee]rror:/` \n    - If this plugin receives the specific error message that matched this RegExp at start-up, \n    assumes the server has error.\n\n- `killSignal`  \n    - type: {String}\n    - default: `SIGTERM`\n\n**callback( error )**  \n\n\n###server.restart( [callback] ) / server.changed( [callback] )\n\n**callback( error )**  \n\n\n###server( [options] )\n\nCreate a `Transform` stream.\nRestart the server at once when this stream gets files.\n\n\n###server.kill( [signal, callback] )\n\nSend kill signal to the server process.  \n**signal {String}**  \n**callback( error )**  \n\n\n###server.reset( [signal, callback] )\n\nSend kill signal to the server process and reset the options to default.   \n**signal {String}**  \n**callback( error )**  \n\n\n\nmore examples\n-------------\n\n####with [gulp-livereload](https://github.com/vohof/gulp-livereload):\n\n```javascript\nvar gulp       = require( 'gulp' ),\n    server     = require( 'gulp-develop-server' ),\n    livereload = require( 'gulp-livereload' );\n\nvar options = {\n    path: './apps/app.js'\n};\n\nvar serverFiles = [\n    './apps/app.js',\n    './routes/*.js'\n];\n\ngulp.task( 'server:start', function() {\n    server.listen( options, livereload.listen );\n});\n\n// If server scripts change, restart the server and then livereload.\ngulp.task( 'default', [ 'server:start' ], function() {\n    \n    function restart( file ) {\n        server.changed( function( error ) {\n            if( ! error ) livereload.changed( file.path );\n        });\n    }\n\n    gulp.watch( serverFiles ).on( 'change', restart );\n});\n```\n\n\n####with [BrowserSync](https://github.com/BrowserSync/browser-sync):\n\n```javascript\nvar gulp   = require( 'gulp' ),\n    server = require( 'gulp-develop-server' ),\n    bs     = require( 'browser-sync' );\n\nvar options = {\n    server: {\n        path: './apps/app.js',\n        execArgv: [ '--harmony' ]\n    },\n    bs: {\n        proxy: 'http://localhost:3000'\n    }\n};\n\nvar serverFiles = [\n    './apps/app.js',\n    './routes/*.js'\n];\n\ngulp.task( 'server:start', function() {\n    server.listen( options.server, function( error ) {\n        if( ! error ) bs( options.bs );\n    });\n});\n\n// If server scripts change, restart the server and then browser-reload.\ngulp.task( 'server:restart', function() {\n    server.restart( function( error ) {\n        if( ! error ) bs.reload();\n    });\n});\n\ngulp.task( 'default', [ 'server:start' ], function() {\n    gulp.watch( serverFiles, [ 'server:restart' ] )\n});\n```\n\n\n####use as a stream:\n\n```javascript\nvar gulp   = require( 'gulp' ),\n    server = require( 'gulp-develop-server' ),\n    bs     = require( 'browser-sync' ),\n    coffee = require( 'gulp-coffee' );\n\nvar options = {\n    server: {\n        path: './apps/app.js',\n        execArgv: [ '--harmony' ]\n    },\n    bs: {\n        proxy: 'http://localhost:3000'\n    }\n};\n\nvar serverCoffee = [\n    './src/*.coffee'\n];\n\ngulp.task( 'server:start', function() {\n    server.listen( options.server, function( error ) {\n        if( ! error ) bs( options.bs );\n    });\n});\n\n// If server side's coffee files change, compile these files,\n// restart the server and then browser-reload.\ngulp.task( 'server:restart', function() {\n    gulp.src( serverCoffee )\n        .pipe( coffee() )\n        .pipe( gulp.dest( './apps' ) )\n        .pipe( server() )\n        .pipe( bs.reload({ stream: true }) );\n});\n\ngulp.task( 'default', [ 'server:start' ], function() {\n    gulp.watch( serverCoffee, [ 'server:restart' ] );\n});\n```\n\n\n\nthanks\n------\n\n[@pronebird](https://github.com/pronebird)  \n[@vkareh](https://github.com/vkareh)  \n[@chimerast](https://github.com/chimerast)  \n[@silverbp](https://github.com/silverbp)  \n[@tomxtobin](https://github.com/tomxtobin)  \n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarirou%2Fgulp-develop-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnarirou%2Fgulp-develop-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarirou%2Fgulp-develop-server/lists"}