Created
April 3, 2018 13:59
-
-
Save faceyspacey/5a2dbf967102fc3efb4423f6390ee10c 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 routes from './routes'; | |
import { render, build } from 'react-universal-starter'; | |
const app = express(); | |
const handler = build(async (req, res) => { | |
try { | |
const html = await render(routes); | |
res.send(html); | |
} catch (error) { | |
res.json(error); | |
} | |
}) | |
app.get('/*', handler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment