forked from Automattic/wp-calypso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (26 loc) · 780 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* External dependencies.
*/
var boot = require( 'boot' ),
http = require( 'http' ),
chalk = require( 'chalk' );
/**
* Internal dependencies
*/
var pkg = require( './package.json' ),
config = require( 'config' );
var start = Date.now(),
port = process.env.PORT || 3000,
host = config( 'hostname' ),
app = boot(),
server,
hotReloader;
console.log( chalk.yellow( '%s booted in %dms - http://%s:%s' ), pkg.name, ( Date.now() ) - start, host, port );
console.info( chalk.cyan( '\nGetting bundles ready, hold on...' ) );
server = http.createServer( app );
server.listen( port );
// Enable hot reloader in development
if ( config( 'env' ) === 'development' ) {
hotReloader = require( 'bundler/hot-reloader' );
hotReloader.listen( server, app.get( 'compiler' ) );
}