Created
June 28, 2016 13:30
-
-
Save chuck0523/a900a881561cf6196215b423bd097753 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
import express from 'express' | |
import React from 'react' | |
import ReactDOMServer from 'react-dom/server' | |
import Hello from './components/Hello' | |
const app = express() | |
app.use(express.static('public')) | |
app.get('/', (req, res) => { | |
res.send( | |
ReactDOMServer.renderToString( | |
<div> | |
<div id="app"> | |
<Hello /> | |
</div> | |
<script src="client.js" /> | |
</div> | |
) | |
) | |
}) | |
app.listen(3000, () => { | |
console.log('Example app is listening on port 3000!') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment