Created
October 19, 2017 08:50
-
-
Save abel0b/dd807ea793ee82da495f95d3998c9bfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (request, response, next) { | |
let html = ReactDOMServer.renderToString(React.createElement( | |
StaticRouter, | |
{ | |
location: request.url, | |
context: {} | |
}, | |
React.createElement(App) | |
)); | |
response.send(` | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello world</title> | |
<link rel="stylesheet" href="/styles.min.css"> | |
</head> | |
<body> | |
<noscript>You need to enable JavaScript to run this app.</noscript> | |
<main id="app">${ html }</main> | |
<script src="/bundle.min.js"></script> | |
</body> | |
</html> | |
`); | |
next(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment