Put helpers into utils folder

This commit is contained in:
LordMathis 2017-10-27 14:37:12 +02:00
parent d7df24b1f3
commit 9127391316
4 changed files with 8 additions and 4 deletions

View File

@ -28,10 +28,10 @@ if (process.env.NODE_ENV === 'development') {
app.use(require('express').static('public')) app.use(require('express').static('public'))
var api = require('./api'); var api = require('./utils/api');
api(app); api(app);
var serverRender = require('./serverRender') var serverRender = require('./utils/serverRender')
app.get("*", serverRender) app.get("*", serverRender)
app.listen(port, function(error) { app.listen(port, function(error) {

5
src/utils/compiler.js Normal file
View File

@ -0,0 +1,5 @@
const compiler = {
}

View File

@ -2,7 +2,7 @@ import 'babel-polyfill'
import React from 'react' import React from 'react'
import { renderToString } from 'react-dom/server' import { renderToString } from 'react-dom/server'
import { StaticRouter as Router } from 'react-router-dom' import { StaticRouter as Router } from 'react-router-dom'
import { App } from './components/App' import { App } from '../components/App'
@ -34,7 +34,6 @@ function renderFullPage(html) {
</head> </head>
<body> <body>
<div id="root">${process.env.NODE_ENV === 'production' ? html : `<div>${html}</div>`}</div> <div id="root">${process.env.NODE_ENV === 'production' ? html : `<div>${html}</div>`}</div>
<script src="/static/vendor.js"></script>
<script src="/static/bundle.js"></script> <script src="/static/bundle.js"></script>
</body> </body>
</html> </html>