File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
examples/universal/server Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-console, no-use-before-define */
2
+
1
3
import path from 'path' ;
2
4
import Express from 'express' ;
3
5
import qs from 'qs' ;
@@ -9,7 +11,7 @@ import configureStore from '../common/store/configureStore';
9
11
import App from '../common/containers/App' ;
10
12
import { fetchCounter } from '../common/api/counter' ;
11
13
12
- const app = Express ( ) ;
14
+ const app = new Express ( ) ;
13
15
const port = 3000 ;
14
16
15
17
// Use this middleware to server up static files built into dist
@@ -19,16 +21,14 @@ app.use(require('serve-static')(path.join(__dirname, '../dist')));
19
21
app . use ( handleRender ) ;
20
22
21
23
function handleRender ( req , res ) {
22
-
23
24
// Query our mock API asynchronously
24
25
fetchCounter ( apiResult => {
25
-
26
26
// Read the counter from the request, if provided
27
27
const params = qs . parse ( req . query ) ;
28
- const counter = parseInt ( params . counter ) || apiResult || 0 ;
28
+ const counter = parseInt ( params . counter , 10 ) || apiResult || 0 ;
29
29
30
30
// Compile an initial state
31
- let initialState = { counter } ;
31
+ const initialState = { counter } ;
32
32
33
33
// Create a new Redux store instance
34
34
const store = configureStore ( initialState ) ;
You can’t perform that action at this time.
0 commit comments