File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,11 @@ const isProd = env.NODE_ENV === "production";
5
5
const isDev = env . NODE_ENV === "development" ;
6
6
7
7
// do not use isProd, isDev ..etc in render.tsx
8
+ // tslint:disable:object-literal-sort-keys
8
9
export const config = {
9
10
env : env . NODE_ENV ,
11
+ serverHost : env . SERVER_HOST || "localhost" ,
12
+ serverPort : env . SERVER_PORT || 3000 ,
10
13
isDev,
11
14
isProd,
12
15
staticPath : isProd && path . resolve ( __dirname , "../client" )
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const app = express();
9
9
app . use ( serveFavicon ( path . resolve ( config . staticPath , "favicon.ico" ) ) ) ;
10
10
app . use ( "/static/" , express . static ( config . staticPath ) ) ;
11
11
12
- if ( process . env . NODE_ENV === "development" ) {
12
+ if ( ! config . isProd ) {
13
13
14
14
// tslint:disable:no-var-requires
15
15
const webpack = require ( "webpack" ) ;
@@ -44,14 +44,14 @@ if (process.env.NODE_ENV === "development") {
44
44
45
45
Loadable . preloadAll ( )
46
46
. then ( ( ) => {
47
- app . listen ( 3000 , ( err : any ) => {
47
+ app . listen ( config . serverPort , ( err : any ) => {
48
48
if ( err ) {
49
49
// tslint:disable-next-line:no-console
50
50
return console . error ( err ) ;
51
51
}
52
52
// tslint:disable-next-line:no-console
53
- console . log ( " running at http://localhost:3000" ) ;
53
+ console . log ( ` running at http://localhost:${ config . serverPort } ` ) ;
54
54
// tslint:disable-next-line:no-console
55
- console . log ( `environemt: ${ process . env . NODE_ENV } ` ) ;
55
+ console . log ( `environemt: ${ config . env } ` ) ;
56
56
} ) ;
57
57
} ) ;
You can’t perform that action at this time.
0 commit comments