Skip to content

Instantly share code, notes, and snippets.

@faceyspacey
Created April 3, 2018 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faceyspacey/5a2dbf967102fc3efb4423f6390ee10c to your computer and use it in GitHub Desktop.
Save faceyspacey/5a2dbf967102fc3efb4423f6390ee10c to your computer and use it in GitHub Desktop.
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