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