Created
December 5, 2016 02:45
-
-
Save hyperh/e75332b966817c705372072fe1816f33 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 { renderToString } from 'react-dom/server'; | |
import App from '../app/components/App'; | |
import template from '../app/template'; | |
const app = express(); | |
app.get('/', (req, res) => { | |
const appString = renderToString(<App />); | |
res.send(template({ | |
body: appString, | |
title: 'FROM THE SERVER' | |
})); | |
}); | |
const port = 3000; | |
app.listen(port); | |
console.log(`Listening on port ${port}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment