Skip to content

Instantly share code, notes, and snippets.

@oieduardorabelo
Last active December 19, 2018 07:01
Show Gist options
  • Save oieduardorabelo/41296ecb403346f35437c7308184f988 to your computer and use it in GitHub Desktop.
Save oieduardorabelo/41296ecb403346f35437c7308184f988 to your computer and use it in GitHub Desktop.
const React = require('react');
const ReactDOM = require('react-dom/server');
const { renderStatic } = require('glamor/server');
const http = require('http');
const Component = require('....');
const props = {}
const yolo = React.createElement(Component, props);
console.log(Yolo);
const yoloString = ReactDOM.renderToString(yolo);
console.log(YoloString);
const yoloStatic = renderStatic(() => yoloString);
http
.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write(yoloStatic.html);
res.end();
})
.listen(1234);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment