@@ -2,7 +2,7 @@ var http = require('http');
2
2
3
3
var express = require ( 'express' ) ;
4
4
5
- require ( 'console-stamp' ) ( console , " HH:MM:ss.l" ) ;
5
+ require ( 'console-stamp' ) ( console , ' HH:MM:ss.l' ) ;
6
6
7
7
var app = express ( ) ;
8
8
@@ -11,36 +11,44 @@ app.use(require('morgan')('short'));
11
11
// ************************************
12
12
// This is the real meat of the example
13
13
// ************************************
14
- ( function ( ) {
15
-
14
+ ( function ( ) {
16
15
// Step 1: Create & configure a webpack compiler
17
16
var webpack = require ( 'webpack' ) ;
18
- var webpackConfig = require ( process . env . WEBPACK_CONFIG ? process . env . WEBPACK_CONFIG : './webpack.config' ) ;
17
+ var webpackConfig = require ( process . env . WEBPACK_CONFIG
18
+ ? process . env . WEBPACK_CONFIG
19
+ : './webpack.config' ) ;
19
20
var compiler = webpack ( webpackConfig ) ;
20
21
21
22
// Step 2: Attach the dev middleware to the compiler & the server
22
- app . use ( require ( "webpack-dev-middleware" ) ( compiler , {
23
- logLevel : 'warn' , publicPath : webpackConfig . output . publicPath
24
- } ) ) ;
23
+ app . use (
24
+ require ( 'webpack-dev-middleware' ) ( compiler , {
25
+ logLevel : 'warn' ,
26
+ publicPath : webpackConfig . output . publicPath ,
27
+ } )
28
+ ) ;
25
29
26
30
// Step 3: Attach the hot middleware to the compiler & the server
27
- app . use ( require ( "webpack-hot-middleware" ) ( compiler , {
28
- log : console . log , path : '/__webpack_hmr' , heartbeat : 10 * 1000
29
- } ) ) ;
31
+ app . use (
32
+ require ( 'webpack-hot-middleware' ) ( compiler , {
33
+ log : console . log ,
34
+ path : '/__webpack_hmr' ,
35
+ heartbeat : 10 * 1000 ,
36
+ } )
37
+ ) ;
30
38
} ) ( ) ;
31
39
32
40
// Do anything you like with the rest of your express application.
33
41
34
- app . get ( "/" , function ( req , res ) {
42
+ app . get ( '/' , function ( req , res ) {
35
43
res . sendFile ( __dirname + '/index.html' ) ;
36
44
} ) ;
37
- app . get ( " /multientry" , function ( req , res ) {
45
+ app . get ( ' /multientry' , function ( req , res ) {
38
46
res . sendFile ( __dirname + '/index-multientry.html' ) ;
39
47
} ) ;
40
48
41
49
if ( require . main === module ) {
42
50
var server = http . createServer ( app ) ;
43
- server . listen ( process . env . PORT || 1616 , function ( ) {
44
- console . log ( " Listening on %j" , server . address ( ) ) ;
51
+ server . listen ( process . env . PORT || 1616 , function ( ) {
52
+ console . log ( ' Listening on %j' , server . address ( ) ) ;
45
53
} ) ;
46
54
}
0 commit comments