-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate server from run-server for mocha
- Loading branch information
Showing
4 changed files
with
43 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var utils = require('./lib/utils.js') | ||
var app = require('./server.js') | ||
var browserSync = require('browser-sync') | ||
var packageJson = require('./package.json') | ||
|
||
// Grab environment variables specified in Procfile or as Heroku config vars | ||
var releaseVersion = packageJson.version | ||
var env = process.env.NODE_ENV || 'development' | ||
|
||
console.log('\nGOV.UK Prototype kit v' + releaseVersion) | ||
// Display warning not to use kit for production services. | ||
console.log('\nNOTICE: the kit is for building prototypes, do not use it for production services.') | ||
|
||
// start the app | ||
utils.findAvailablePort(app, function (port) { | ||
console.log('Listening on port ' + port + ' url: http://localhost:' + port) | ||
if (env === 'production') { | ||
app.listen(port) | ||
} else { | ||
app.listen(port - 50, function () { | ||
browserSync({ | ||
proxy: 'localhost:' + (port - 50), | ||
port: port, | ||
ui: false, | ||
files: ['public/**/*.*', 'app/views/**/*.*'], | ||
ghostmode: false, | ||
open: false, | ||
notify: false, | ||
logLevel: 'error' | ||
}) | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters