Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Last active August 30, 2019 03:25
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ryanflorence/e639268ae42dfe37aeade4e5295e490b to your computer and use it in GitHub Desktop.
Save ryanflorence/e639268ae42dfe37aeade4e5295e490b to your computer and use it in GitHub Desktop.
const React = require('react')
const ReactDOMServer = require('react-dom/server')
const { createServer } = require('http')
const App = require('./build/static/js/main.49fed57c').default
createServer((req, res) => {
const el = React.createElement(App)
const html = ReactDOMServer.renderToString(el)
res.write(html)
res.end()
}).listen(3000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment