File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 2222 "node-uuid" : " ^1.4.2" ,
2323 "object-assign" : " ^4.0.1" ,
2424 "pluralize" : " ^1.1.2" ,
25+ "server-destroy" : " ^1.0.1" ,
2526 "underscore-db" : " ^0.9.1" ,
2627 "update-notifier" : " ^0.5.0" ,
2728 "yargs" : " ^3.10.0"
Original file line number Diff line number Diff line change 11var fs = require ( 'fs' )
22var path = require ( 'path' )
33var chalk = require ( 'chalk' )
4+ var enableDestroy = require ( 'server-destroy' )
45var is = require ( './utils/is' )
56var load = require ( './utils/load' )
67var watch = require ( './watch' )
@@ -111,6 +112,9 @@ module.exports = function (argv) {
111112 app = createApp ( source , data , routes , argv )
112113 server = app . listen ( argv . port , argv . host )
113114
115+ // Enhance with a destroy function
116+ enableDestroy ( server )
117+
114118 // Display server informations
115119 prettyPrint ( argv , data , routes )
116120
@@ -143,7 +147,7 @@ module.exports = function (argv) {
143147 console . log ( )
144148 watch ( argv , function ( file ) {
145149 console . log ( chalk . gray ( ' ' + file + ' has changed, reloading...' ) )
146- server && server . close ( )
150+ server && server . destroy ( )
147151 start ( )
148152 } )
149153 }
You can’t perform that action at this time.
0 commit comments